how to count the total number of lines in a text file using python,count = sum(1 for line in myfile if line.rstrip('\n'))