On 5/24/18 6:54 PM, bruceg113...@gmail.com wrote:
I am trying to convert a string to a variable.
I got cases 1 & 2 to work, but not cases 3 & 4.
The print statement in cases 3 & 4 reports the following:
builtins.AttributeError: type object 'animal' has no attribute 'tiger'
I am stuck on creating variables that can be accessed as follows.
animal.tiger
self.animal.tiger
Any suggestions?
Usually when people want to turn strings into variables, the best answer
is to not make variables, but instead have a dictionary.
But I don't know what you are going to do with "animal.tiger", so I'm
not sure the best answer. Can you say more about the whole problem?
--Ned.
--
https://mail.python.org/mailman/listinfo/python-list