I have a class with several variables inside
class myClass():
def __init__(self):
self.first = ""
self.second = ""
self.third = ""
Ok, so if I then initialize a variable to that class, I understand that I can easily reference or set any of those class variables like this
myClassVar = myClass()
myClassVar.first = "foo"
myClassVar.second = "bar"
What I'm wanting to know is, what if the class variable I want to set is itself determined by another variable. for instance, if I looped through a list ["first", "second", "third"], is there any way to reference those class variables like this:
varList = ["first", "second", "third"]
for item in varList:
myClass.item = "whatever I want to set it to"
Something like what I just did will result in "myClass has no 'item' member"