Rahul Gupta wrote:

>     for line in enumerate(csv_reader):
>         print(line[csv_reader.fieldnames[1]])

enumerate() generates (index, line) tuples that you need to unpack:

    for index, line in enumerate(csv_reader):
        print(line[csv_reader.fieldnames[1]])

If you want to keep track of the row count you can modify the above like so:

    row_count = 0
    for row_count, line in enumerate(csv_reader, 1):
        print(line[csv_reader.fieldnames[1]])


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to