x = 14 variable_name = 'x'
How can I get the value of x when I only have the name of it as a string?
You can use vars():
vars()
vars()[variable_name]
Which gives the variables of the scope it's called at (Source).