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:
Due to captcha issues with the Gutenberg site, I saved a copy of the document on my hard drive.
page = open('meta.htm', 'r').read()
soup = BeautifulSoup(page, "lxml")
How do I use soup.prettify()
to print out the first and last 1000 lines of the document?