How to skip first two rows while reading a file in Python?

Ah, skipping lines in Python, something I’ve done quite a few times. One simple way to do it is by using readlines(). You can read all lines from the file and just slice the list from the third line onward. Like this:

myFile = open("football.txt", "r")
lines = myFile.readlines()[2:]  # Skips the first two lines
# rest of the code

This is straightforward when you know exactly how many lines you need to skip. But, let’s say you’re looking for a more flexible approach…