Re: finding out the number of rows in a CSV file [Resolved]
John S wrote:
>
A CSV file is just a text file. Don't use csv.reader for counting rows
-- it's overkill. You can just read the file normally, counting lines
(lines == rows).
$ more sample.csv
"Except
when it
isn't."
1
3
</F>
John S wrote:
>>after reading the file throughthe csv.reader for the length I cannot
>>iterate over the rows. How do I reset the row iterator?
>>iterate over the rows. How do I reset the row iterator?
A CSV file is just a text file. Don't use csv.reader for counting rows
-- it's overkill. You can just read the file normally, counting lines
(lines == rows).
"Except
when it
isn't."
>>import csv
>>len(list(csv. reader(open('sa mple.csv'))))
>>len(list(csv. reader(open('sa mple.csv'))))
>>len(list(open ('sample.csv')) )
</F>
Comment