[Tutor] class attributes
Kent Johnson
kent37 at tds.net
Wed Nov 16 23:38:58 CET 2005
Eric Walker wrote:
> ahh, you just blew smoke in my face. :)
>
> I have a class with attributes. These attributes eventually have the value of
> some lines in a file. I am now going back through my object list of that
> class and assigning values to the attributes depending on another variable
> that will change and be the same names like the class attribute names. I
> want to use that change in name to be able to access the attribute and set
> its value. Did I say that right????
Use getattr() to read an attribute by name and setattr() to set it.
Kent
More information about the Tutor
mailing list