Comment vérifier si var existe Python
# for local
if 'myVar' in locals():
# myVar exists.
# for globals
if 'myVar' in globals():
# myVar exists.
Filthy Fish
# for local
if 'myVar' in locals():
# myVar exists.
# for globals
if 'myVar' in globals():
# myVar exists.
# None signifies undefined
if x is None:
some_fallback_operation( )
else:
some_operation(x)