Test if variable exists in python

Here is how to test if a variable exists

try: x
except NameError:
# x doesn't exist, do something
# x exists, do something else


Sergiu said…
Thanks...i've been searching for this for a while. Yuo should post more on python :)
APOORV said…
hmmm ... nice .... good work

Popular posts from this blog

Vim vi how to reload a file your editing