Test to see if variable exists

Gabriel Cooper gabriel.cooper at mediapulse.com
Tue Aug 12 13:01:24 EDT 2003


lamar_air wrote:

>I need an if statement to test if a variable exists in a pyton script
>
>eg. if var1 exists:  
>          do this
>     else:
>          do this
>
If it's in a dictionary you can do this: var1.get('key','not found')

( just learned that all of 2 minutes ago ;] )






More information about the Python-list mailing list