L
lamar_air
I need an if statement to test if a variable exists in a pyton script
eg. if var1 exists:
do this
else:
do this
eg. if var1 exists:
do this
else:
do this
If it's in a dictionary you can do this: var1.get('key','not found')lamar_air said:I need an if statement to test if a variable exists in a pyton script
eg. if var1 exists:
do this
else:
do this
locals().has_key('var1')
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.