how to get the number of lines in a text file and read lines after that in python 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 reading lines from a text file
with open(filename) as f:
content = f.readlines()
# you may also want to remove whitespace characters like `\n` at the end of each line
content = [x.strip() for x in content]