I would like to convert a python variable name into the string equivalent as shown. Any ideas how?
var = {} print ??? # Would like to see \'var\' something_
To get the variable name of var as a string:
var
var = 1000 var_name = [k for k,v in locals().items() if v == var][0] print(var_name) # ---> outputs 'var'