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

    Jul 11, 2016 · In Python, variables that are only referenced inside a function are implicitly global. If a variable is assigned a new value anywhere within the function’s body, it’s assumed to be a local.

  2. Crear variables globales en Python - Stack Overflow en español

    Jul 19, 2019 · Yo soy bastante nuevo con la sintaxis de Python en particular como crear global, nonlocal y local variables y como declararlas sin errores de sintaxis. Por ejemplo en el programo siguiente, …

  3. How to set a global variable in Python - Stack Overflow

    Ok, so I've been looking around for around 40 minutes for how to set a global variable on Python, and all the results I got were complicated and advanced questions and more so answers. I'm trying t...

  4. In Python what is a global statement? - Stack Overflow

    Dec 14, 2012 · What is a global statement? And how is it used? I have read Python's official definition; however, it doesn't make a lot of sense to me.

  5. Funções em Python-Variáveis globais e locais

    Jul 6, 2018 · Em Python, as variáveis declaradas dentro de funções são tratadas como atributos dentro de objetos, e esses atributos podem ser acessados a partir do escopo global usando o nome do …

  6. Использование global в Python - Stack Overflow на русском

    Jan 7, 2018 · Здравствуйте, знакомлюсь с python и после c++ категорически не понимаю принцип использования global переменных. Если у переменной, находящейся в def указать global то …

  7. How do you declare a global constant in Python?

    Jun 10, 2014 · The global keyword in Python is used to modify a global variable in a local context (as explained here). This means that if the op modifies SOME_CONSTANT within myfunc the change …

  8. 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.

  9. python - How can I change a global variable from within a function ...

    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 exists inside your …

  10. How can I access global variable inside class in Python

    May 30, 2012 · I understand using a global variable is sometimes the most convenient thing to do, especially in cases where usage of class makes the easiest thing so much harder (e.g., …