Just as a note - you are not the only person caught out by this - it is a very common slip.
I wonder whether it would be worth adding a more explicit line about this in the Python Docs? Matt On Wed, 3 Feb 2016 16:13 Ek Esawi <esaw...@gmail.com> wrote: > Hi All > > > > > > I have a code that reads a csv file via DictReader. I ran into a peculiar > problem. The python interpreter ignores the 2nd code. That is if I put the > reader iterator 1st, like the code below, the enumerate code is ignored; if > I put the enumerate code 1st, the reader code is ignored. I am curious to > know the nature of such behavior. EKE > > > > Here part of my code: > > > > . > > . > > . > > reader = csv.DictReader(MyFile) > > for row in reader: > > list_values = list(row.values()) > > print (list_values) > > > > for i,j in enumerate(reader): > > print(j) > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor