Use len() and list() on a csv reader to count the number of lines. lets go to this sample.csv data 1,2,3 4,5,6 7,8,9 file_data = open("sample.csv") reader = csv.reader(file_data) Count_lines= len(list(reader)) print(Count_lines) OUTPUT:- 3 As you can see from the sample.csv file that there were three rows that got displayed with the help of the len() function.