how to change the name of a variable in a loop python

Solutions on MaxInterview for how to change the name of a variable in a loop python by the best coders in the world

showing results for - "how to change the name of a variable in a loop python"
Leni
02 Feb 2020
1for i in range(3):
2    locals()["group"+str(i)] = self.getGroup(selected, header+i)
3
Elon
23 Jan 2019
1for i in group(3):
2    setattr(self, "group"+str(i), self.getGroup(selected, header+i)
3