Question: Evaluate an string variable's value to a variable

Mir Nazim mirnazim at
Sun Dec 21 07:49:29 CET 2008

Just a quick question.

For example I have

>>> class X
>>> ....pass

Then I do
>>> x = X()
>>> = 'Nazim

Now my question is whether something like below is possible and how
>>> y = 'name'
>>> print x.y   #  How can x.y can be evaluated to

PS: In PHP this can be done by a $x->$y. I sure there is some way in
Python also

Thanks in advance.

More information about the Python-list mailing list