Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python getting line count

def file_len(fname):
    with open(fname) as f:
        for i, l in enumerate(f):
            pass
    return i + 1

print(file_len("my_file.txt"))
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #python #line #count
ADD COMMENT
Topic
Name
3+9 =