finding out the number of rows in a CSV file

Simon Brunning simon at brunningonline.net
Wed Aug 27 13:29:20 CEST 2008


2008/8/27 SimonPalmer <simon.palmer at gmail.com>:
> anyone know how I would find out how many rows are in a csv file?
>
> I can't find a method which does this on csv.reader.

len(list(csv.reader(open('my.csv'))))

-- 
Cheers,
Simon B.
simon at brunningonline.net
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list