0

I want to have the number of rows for some CSV files.

I have found that can be easily done with len&list functions.

reader = csv.reader(base_data, delimiter=',', quoting=csv.QUOTE_MINIMAL, lineterminator="\n"
total_line = len(list(reader))

The problem is that after have the information about the number of row of the csv file, I would like to iterate on the reader object

for line in reader:
    id_revision = line[0]
...

Without the len&list function the iteration works, but when I calculate the number of row the iteration doesn't even begin.(Process finish without error)

BPDESILVA
  • 2,040
  • 5
  • 15
  • 35

0 Answers0