title: read through first N lines of a file in python
body: <p>Typically, when reading a file, I use the for line n fileobject: construct. Is there a simple way to just loop over the first N (or some arbitrary subset) of lines in a file, so that I don't have to read in the entire file?</p>