undefined variable ?

Michael Hoffman m.h.3.9.1.without.dots.at.cam.ac.uk at example.com
Sat Oct 16 14:20:08 CEST 2004

vertigo wrote:

> How can i check if variable named var1 exists ?

It's frequently a better approach to assume that it does and catch an 
exception if it doesn't.

except NameError:
     var1 = "neW"

But why do you want to do this?
Michael Hoffman

More information about the Python-list mailing list