[Tutor] silly question
Alan Gauld
alan.gauld at freenet.co.uk
Thu Dec 23 09:24:47 CET 2004
> how do I change global variables within a function:
>
by declaring them as global.
See my tutorial topic: "Whats in a Name?" for a discussion of this.
> ##################################
> VAR = "TEST"
>
> def m():
> VAR="no test"
creates a new variable insidethe function.
def m():
global VAR
VAR = 'no test'
now changes the global(or at least module scope) VAR.
Alan G.
More information about the Tutor
mailing list