Skip to main content

All Questions

Tagged with
0 votes
0 answers
36 views

How to modify a "Name+2nd name+Surname without touch 2nd name? Phyton

I want to change 2 characters in a variable in phyton but when I fix one the other change again. I have this variable. name= " rIana Danyela RodrYguez " I don't want to touch the name &...
TIFK's user avatar
  • 1
-1 votes
1 answer
46 views

Problems with os.rename | OSError: [WinError 123]

I'm looking to rename one of my files using os.rename, the code is a little bit messy but currently it gives me a result that looks like it should work, but I end up getting an error. (path is removed ...
Idokoond K's user avatar
0 votes
0 answers
57 views

String concatenation to reference a srting variable in Python

new at this so probably the first of a series of silly questions ... Basically I am looking to see how (or if possible) to concatenate a string (say) "row" with a numeric variable (say) i = ...
Scot_Chaos's user avatar
0 votes
1 answer
147 views

Call a variable from a str

I have an Excel spreadsheet - that I read via pandas - with some values corresponding to A + x ; A being an already defined value and x being an int. This Excel is a list of subjects with each subject ...
Luc Borel's user avatar
-1 votes
1 answer
38 views

Getting variable name inside a string in Python

I have a variable db which is read from environment file. I am tryin gto use it inside a cursor execution statements as below. config={} with open('environment.yml','r') as f: config = yaml....
David Jackson's user avatar
10 votes
2 answers
9k views

Is there a way to interpolate variables into a python string WITHOUT using the print function?

Every example I have seen of Python string variable interpolation uses the print function. For example: num = 6 # str.format method print("number is {}".format(num)) # % placeholders print(...
skeetastax's user avatar
  • 1,768
0 votes
3 answers
465 views

What's the best way to pass variables/strings around between functions in Python?

I have a lot of functions that have elements that need to communicate between themselves, but I'm having a dilemma on how to format this for most efficiency. Below I have a few examples of ways I've ...
Petar Pehchevski's user avatar
-1 votes
1 answer
52 views

Use a string object as the variable of the same name [duplicate]

tn = 'convert' print('t'+'n') tn is a string object. But I want to use this string object as the variable of the same name. So I can expect the result declared as a variable, tn.
SH Chung's user avatar
0 votes
0 answers
28 views

how do i convert a string into a variable name? [duplicate]

i have a program making the string "aX". i'm then putting it into an equation where i need to call the variable that i named aX. letters = "abcdefgh" for i in letters: posX = i +...
rin galagali's user avatar
0 votes
2 answers
2k views

Why constants in Python can be changed?

A constant is a variable whose value stays the same throughout the life of a program. Python doesn’t have built-in constant types, but Python programmers use all capital letters to indicate a variable ...
Tarek Hassan's user avatar
0 votes
1 answer
83 views

How does the user's input affect the file and text?

In one python file here is the code(It needs to have at least 1 Capital letter and more than 8 letters. If it doesn't then it should ask for the variable password(not username because it doesnt need ...
Michael Yeboah's user avatar
1 vote
2 answers
166 views

How do I make a program recognize whether to use A or An based on the variable the user inputs?

This is my second day using Python. I'm using Visual Studios Code with Python 3. I'm trying to make a madlib program in python. I'm having trouble with figuring out how to have the program ...
Erin McKee's user avatar
-2 votes
1 answer
82 views

Experimenting with Lists: Why can't I reassign an immutable object? [duplicate]

In the code below When I reassign the value of name, this change is not reflected in the value of student Can someone explain the behaviour of these variables? I am more interested in the process that ...
icecream's user avatar
0 votes
1 answer
39 views

I cannot change the values of a column using python pandas

I am working with the [UCI adult dataset][1]. I have added a row as a header to facilitate operation. I need to change the last column, which can take two values, '<=50k' and '>50k' and whose ...
slow_learner's user avatar
-1 votes
1 answer
177 views

Add variable value in payload string in Python

I have payload string that i want to modify in a loop but i can not figure out how to convert this '41.86464600000019' and this '-87.80732699999984' in variables to replace them in a loop. inserting f{...
oToMaTiX's user avatar
  • 119

15 30 50 per page
1
2 3 4 5
26