Number of cells, using CSV module

Skip Montanaro skip at pobox.com
Thu May 16 15:07:49 EDT 2013


> len(reader) gives me an error.

Apologies.  len(list(reader)) should work.  Of course, you'll wind up
loading the entire CSV file into memory.  You might want to just count
row-by-row:

n = 0
for row in reader:
    n += 1

Skip



More information about the Python-list mailing list