isset in python code example
Example 1: how to check if var exists python
# for local
if 'myVar' in locals():
# myVar exists.
# for globals
if 'myVar' in globals():
# myVar exists.
Example 2: python isset
d = {'foo': 1}
d.get('foo') # 1
d.get('bar') # None