Page 1 of 1

Python : Changing Global Variable's Value from a function

Posted: Fri 06 Sep 2013, 04:45
by suttiwit
How do I change Global Variable's Value (that is situated outside of any functions) from within a function?

Is it possible? How can I do it?

One thing: Don't show me better practices.

Thanks

Got it solved.

Posted: Fri 06 Sep 2013, 05:54
by suttiwit
Got it solved now.
What I did is declare the global variable (eg. gvar) like this in a function:

Code: Select all

global gvar
Pretty cool.