python how many lines in a file read code example
Example 1: python how to count the lines in a file
# Basic syntax:
count = len(open('/path/to/the/file.ext').readlines())
Example 2: python read lines
f = open("filename")
lines = f.readlines()
# Basic syntax:
count = len(open('/path/to/the/file.ext').readlines())
f = open("filename")
lines = f.readlines()