About 276,000 results
Open links in new tab
  1. How can I use a global variable in a function? - Stack Overflow

    Jul 11, 2016 · In Python, the module is the natural place for global data: Each module has its own private symbol table, which is used as the global symbol table by all functions defined in the …

  2. python - How do I create variable variables? - Stack Overflow

    Is it possible to do something like this in Python? What can go wrong? If you are just trying to look up an existing variable by its name, see How can I select a variable by (string) name?. …

  3. python - How to make a local variable (inside a function) global ...

    I'm using functions so that my program won't be a mess but I don't know how to make a local variable into global.

  4. python - Using global variables between files? - Stack Overflow

    25 You can think of Python global variables as "module" variables - and as such they are much more useful than the traditional "global variables" from C. A global variable is actually defined …

  5. Convert string to variable name in python - Stack Overflow

    Convert string to variable name in python [duplicate] Asked 12 years, 1 month ago Modified 5 years, 5 months ago Viewed 455k times

  6. python - Using a string variable as a variable name - Stack Overflow

    Jul 19, 2012 · Using a string variable as a variable name [duplicate] Asked 13 years, 4 months ago Modified 2 years, 10 months ago Viewed 512k times

  7. How do I create a constant in Python? - Stack Overflow

    Apr 21, 2010 · actually the way to make read-only variables is possible via python's property function/decorator. the answer of inv is an example of a custom usage of that. property is more …

  8. How to create module-wide variables in Python? - Stack Overflow

    Dec 30, 2009 · Here is what is going on. First, the only global variables Python really has are module-scoped variables. You cannot make a variable that is truly global; all you can do is …

  9. python - Class (static) variables and methods - Stack Overflow

    Sep 16, 2008 · Although it doesn't say anything specific about static variables or methods, the Python tutorial has some relevant information on classes and class objects. @Steve Johnson …

  10. python - How can I change a global variable from within a …

    The a in your first line is a global variable (so called because it exists in the global scope, outside of any function definitions). The a in the other lines is a local variable, meaning that it only …