I\'m using python (Django Framework) to read a CSV file. I pull just 2 lines out of this CSV as you can see. What I have been trying to do is store in a variable the total n
when you instantiate a csv.reader object and you iter the whole file then you can access an instance variable called line_num providing the row count:
import csv with open('csv_path_file') as f: csv_reader = csv.reader(f) for row in csv_reader: pass print(csv_reader.line_num)