I want to check if a variable exists. Now I\'m doing something like this:
try: myVar except NameError: # Do something.
Are there othe
I created a custom function.
def exists(var): return var in globals()
Then the call the function like follows replacing variable_name with the variable you want to check:
variable_name
exists("variable_name")
Will return True or False
True
False