This works for csv and all files containing strings in Unix-based OSes:
import os
numOfLines = int(os.popen('wc -l < file.csv').read()[:-1])
In case the csv file contains a fields row you can deduct one from numOfLines
above:
numOfLines = numOfLines - 1