[Tutor] names and variables
jmorcombe at westnet.com.au
Wed Aug 20 11:30:37 CEST 2008
I have an object called "myObject" with an attribute called "colour".
If I type:
then python prints:
Now, I have a variable "myAttribute" and set its value to "colour" by
myAttribute = "colour"
I want to have a line of code: something like this:
and have Python interpret it as meaning "print myObject.colour" and
hence print "red"
Can this be done? If so, how?
More information about the Tutor