Created
October 21, 2022 15:08
-
-
Save mh0w/7a5db9d840cbcff6d2c1da6651da743f to your computer and use it in GitHub Desktop.
check if a variable exists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = 1 | |
'a' in locals() # True | |
'z' in locals() # False | |
'a' in globals() # True | |
'z' in globals() # False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment