Re: [Newbie] Referring to a global variable inside a function
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: [Newbie] Referring to a global variable inside a function

From: Ernesto García García <titogarcia_nospamplease_@gmail.com>
Date: Sun Apr 09 2006 - 21:48:59 CEST

>>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
Received on Sun Apr 30 22:38:13 2006