Check for existence?

Charlie Clark charlie at begeistert.org
Tue May 29 06:30:59 EDT 2001


Gerrie Roos wrote:
> I'm very new to Python and got a very basic question:
>
> How do I check to see if a variable exists/is available in the current
> namespace?
>
Just call it and trap the exception if necessary

try:
	print spam
except:
	print "Variable not there"

Charlie



More information about the Python-list mailing list