Parse html using htmllib in python

import htmllib, urllib, formatter, sys
 
website = urllib.urlopen("http://w3mentor.com")
data = website.read()
website.close()
format = formatter.AbstractFormatter(formatter.DumbWriter(sys.stdout))
ptext = htmllib.HTMLParser(format)
ptext.feed(data)
ptext.close()

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.