[Newbie] Referring to a global variable inside a function

Ernesto García García titogarcia_nospamplease_ at gmail.com
Sun Apr 9 15:48:59 EDT 2006


>>How would you do this?
> 
>     def line_action(line, match_dictionary):
>         global count # make it a module-global variable, not a function-local
>         count = count + 1
> 
> </F>

OK, I had put it on the global block.

Thanks,
Ernesto



More information about the Python-list mailing list