I have a function:
def save(self, text, *index):
file.write(text + '\nResults:\n')
if index == (): index = (range(len(self.drinkList)))
for x in index:
for y in self.drinkList[x].ing:
file.write('min: ' + str(y.min) + ' max: ' + str(y.max) + ' value: ' + str(y.perc) + '\n')
file.write('\n\n')
file.write('\nPopulation fitness: ' + str(self.calculatePopulationFitness()) + '\n\n----------------------------------------------\n\n')
Now, when I pass one argument as an index the function works as it is supposed to, but when I pass a tuple of 2 indices I get an TypeError: list indices must be integers, not tuple. What should I change?