Answers for "number of lines in a text file python"

16

python how to count the lines in a file

# Basic syntax:
count = len(open('/path/to/the/file.ext').readlines())
Posted by: Guest on October-04-2020
0

count lines in file python

num_lines = sum(1 for line in open('myfile.txt'))
Posted by: Guest on November-17-2021

Code answers related to "number of lines in a text file python"

Python Answers by Framework

Browse Popular Code Answers by Language