finding out the number of rows in a CSV file

Simon Brunning simon at brunningonline.net
Wed Aug 27 13:48:46 CEST 2008


2008/8/27 Jon Clements <joncle at googlemail.com>:

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

> Not the best of ideas if the row size or number of rows is large!
> Manufacture a list, then discard to get its length -- ouch!

I do try to avoid premature optimization. ;-)

-- 
Cheers,
Simon B.



More information about the Python-list mailing list