About 405,000 results
Open links in new tab
  1. What is the naming convention in Python for variables and functions ...

    See Python PEP 8: Function and Variable Names: Function names should be lowercase, with words separated by underscores as necessary to improve readability. Variable names follow the same …

  2. python - Why do some functions have underscores "__" before and …

    May 24, 2024 · 34 Names surrounded by double underscores are "special" to Python. They're listed in the Python Language Reference, section 3, "Data model".

  3. python - Getting the name of a variable as a string - Stack Overflow

    Aug 25, 2013 · Variables don't "have names"; "variable" means the same thing as "name" in Python. Presumably you meant value (as in, the actual object that is being named); but values don't actually …

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

    How do you create different variable names while in a loop? [duplicate] Asked 14 years, 7 months ago Modified 5 years, 6 months ago Viewed 700k times

  5. 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 is a bad idea in …

  6. python - Viewing all defined variables - Stack Overflow

    Mar 11, 2009 · It shows the same details as the MATLAB analog (variable name, type, and value/data). Note that in the Python interpreter, whos lists all variables in the "interactive namespace".

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

    Jul 19, 2012 · I have a variable with a string assigned to it and I want to define a new variable based on that string.

  8. What is the purpose of the single underscore "_" variable in Python?

    May 5, 2011 · An unused variable is often hiding a bug/typo (e.g. set day but use dya in the next line). The pattern matching feature added in Python 3.10 elevated this usage from "convention" to …

  9. How can you print a variable name in python? [duplicate]

    That said, Python does have built-in namespaces. For example, locals () will return a dictionary mapping a function's variables' names to their values, and globals () does the same for a module.

  10. arrays - Python List as variable name - Stack Overflow

    I've been playing with Python and I have this list that I need worked out. Basically I type a list of games into the multidimensional array and then for each one, it will make 3 variables based on ...