title: In Python, how can I read a yet-unknown number of lines from a txt file?
body: <p>This is the use case. I have a text file potentially hundreds of thousands of lines long, where:
  The first line contains the integer <em>N</em>, which is the number of following lines. I know how to read and convert the first line to an int; however, I have searched for a method to then read that number of lines from the file without success.</p>
  
  <p>For example:
  input.txt</p>
  
  <pre><code>4
  foo
  bar
  carrot
  snowflake
  </code></pre>
  
  <p>I will read and store the lines in variables. There are no blank lines.</p>
  
  <p>How can I get the next <em>N</em> lines from my text file, preferably in a Pythonic way?</p>