python how to access global variable from method / function

>>> v = 1
>>> global v
>>> print v
1
>>> def i():
... global v
... v = v + 1
... print v

http://www.python.org/doc/2.0.1/ref/global.html

Comments

Popular posts from this blog

Vim vi how to reload a file your editing