On Aug 27, 12:16 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
> 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.
>
> Thanks in advance

You have to iterate each row and count them -- there's no other way
without supporting information (since each row length is naturally
variable, you can't even use the file size as an indicator).

Something like:

row_count = sum(1 for row in csv.reader( open('filename.csv') ) )

hth
Jon.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to