Last active
October 6, 2019 18:05
-
-
Save feltmax/e59912a9f34e34015c050947d6169b80 to your computer and use it in GitHub Desktop.
get variable name list in python3
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
var_name = lambda val : [k for k, v in globals().items() if id(v) == id(val)] | |
a = 1 | |
s = var_name(a)[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment