for row in csv_reader:
    count += 1
print(('Elapsed time : ', time.time() - t0))
print(('count = ', count))
print('\n')
print('# for i, line in enumerate(f, 1):')
t0 = time.time()
count = 0
with open(filename) as f:
    for i, line in enumerate(f, 1):
        count += 1
print(('Elapsed time : ', time.time() - t0))
print(('count = ', count))
print('\n')
Count how many lines are in a CSV Python?