Is there a possibility (e.g. a built-in function) to convert a string to a char in python? For example, if I assign a value to the variable
p1=100
and then have the string
"p1",
is it possible to assign the value of p1 to a new variable t like
t=char("p1")
so that I get
print(t)->100 ?
Obviously, above mentioned solution does not work as it throws following error message:
NameError: name 'char' is not defined
Edit: The question is not about best practices: I know that I should do this with a dictionary, but what I am trying to do is to understand data types in Python and how to convert them. Convert a string to an integer is fairly easy, for example, so I was wondering if the same applies to string to char conversions. The eval() command does solve the example's question, but it does not answer above mentioned problem. So I would edit the goal to
char("p11")=20
which should give me
print(p11) -> 20