title: How to print out the first and last 1000 lines using beautiful soup
body: <p>I am trying to print out the first and last 1000 lines using "prettify' from BeautifulSoup.  I have downloaded Kafka's The Metamorphosis to my hard drive and I've successfully created a BeautifulSoup object:</p>
  
  <p>Due to captcha issues with the Gutenberg site, I saved a copy of the document on my hard drive.</p>
  
  <pre><code>page = open('meta.htm', 'r').read()
  soup = BeautifulSoup(page, "lxml")
  </code></pre>
  
  <p>How do I use <code>soup.prettify()</code> to print out the first and last 1000 lines of the document?</p>