[Tutor] silly question

jasonchild at cnsp.com jasonchild at cnsp.com
Thu Dec 23 15:21:24 CET 2004


awesome. thanks for the advice!

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