[Tutor] line number when reading files using csv module

Bob Gailer bgailer at alum.rpi.edu
Fri Oct 27 20:42:35 CEST 2006

Duncan Gibson wrote:
> [snip]

> but I would like to record the line number in the file. 
How about using enumerate():
>     for line_num, data in enumerate(reader):
>         print reader.line_num, data

Bob Gailer

More information about the Tutor mailing list