About 50 results
Open links in new tab
  1. python - How do I create variable variables? - Stack Overflow

    I know that some other languages, such as PHP, support a concept of "variable variable names" - that is, the contents of a string can be used as part of a variable name. I heard that this...

  2. python - How do you create different variable names while in a loop ...

    27 It's simply pointless to create variable variable names. Why? They are unnecessary: You can store everything in lists, dictionarys and so on They are hard to create: You have to use exec or globals() …

  3. python - How can you dynamically create variables? - Stack Overflow

    I want to create variables dynamically in Python. Does anyone have any creative means of doing this?

  4. python - Convert dictionary entries into variables - Stack Overflow

    14 Consider the "Bunch" solution in Python: load variables in a dict into namespace. Your variables end up as part of a new object, not locals, but you can treat them as variables instead of dict entries.

  5. How do I create a multiline Python string with inline variables ...

    Alternatively, you can also create a multiline f-string with triple quotes where literal newlines are considered part of the string. However, any spaces at the start of the line would also be part of the …

  6. How to set environment variables in Python? - Stack Overflow

    I need to set some environment variables in the Python script and I want all the other scripts that are called from Python to see the environment variables' set. If I do, os.environ["DEBUSSY&q...

  7. python - How can I create new variables in a loop, with the names and ...

    Closed 2 years ago. How can I create new variables with the names and values coming from a list? This:

  8. Python: How to create new variable in each iteration of a for loop?

    Dec 9, 2013 · Ideally this could create variables like line1, line2, ect to equal the string outputs from each iteration. Then I could string these together outside the loop to get my desired string.

  9. python - Create dictionary from list of variables - Stack Overflow

    Feb 29, 2012 · I'm looking for a way to create a dictionary without writing the key explicitly. I want to create a function that gets the number of variables and creates a dictionary where the variable …

  10. how to create class variable dynamically in python

    Signature: setattr(obj, name, value, /) Docstring: Sets the named attribute on the given object to the specified value. setattr(x, 'y', v) is equivalent to ``x.y = v'' Type: builtin_function_or_method Example …