0 votes
in Python Flask by
Write a Python program to count the total number of lines in a text file?

1 Answer

0 votes
by
def file_count(fname):

with open(fname) as f:

for i, 1 in enumerate(f):

paas

return i+1

print(“Total number of lines in the text file: ”, file_count(“file.txt”))

Related questions

0 votes
asked Oct 22, 2020 in NLP using Python by rahuljain1
+1 vote
asked Dec 27, 2022 in Digital Primer by john ganales
...