Answers for "count lines in 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

Python Answers by Framework

Browse Popular Code Answers by Language