xxxxxxxxxx
def get_variable_name(var):
# Iterate over the global variables
for name, value in globals().items():
if value is var:
return name
return None
# Example usage
my_variable = 10
var_name = get_variable_name(my_variable)
print(var_name) # Output: my_variable
xxxxxxxxxx
# Equalize your varaible name to dict()
VariableName =dict()
# split as follow
print(f'{VariableName=}'.split('=')[0])