I am making a desktop programm with Qt+Python and currently I am facing a problem calling some attributes with variable in their names
self.checkBox_Answer1.clear()
self.checkBox_Answer2.clear()
self.checkBox_Answer3.clear()
self.checkBox_Answer4.clear()
Number is the variable, so I want something like
self."checkBox_Answer%d" % (A).clear()
where "A" is my variable which is counted, but coding this way doesnt work
Also tried
self.str("checkBox_Answer"+"%d" % (A)).clear()
self.checkBox_Answer+"%d" % (A).clear()
and nothing works
I know I can do something like
if A == 1:
self.checkBox_Answer1.clear()
if A == 2:
self.checkBox_Answer2.clear()
if A == 3:
self.checkBox_Answer3.clear()
if A == 4:
self.checkBox_Answer4.clear()
But isn't there more pythonic way to do this stuff?