Modification of the list items in the loop (python) [duplicate]
Try this instead: for i in xrange(len(data)): data[i] = “everything” The basic problem you’re having is that when you write data[i], with data being a list, the i needs to be an integer, a numerical index into the list. But in the loop for item in data item is the actual thing that’s in the … Read more