[Tutor] Enumerate vs DictReader object manipulation:

Ek Esawi esawiek at gmail.com
Wed Feb 3 10:29:49 EST 2016

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):


More information about the Tutor mailing list