Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from HTMLParser import HTMLParser
- import urlib2
- class MyHTMLParser(HTMLParser):
- def handle_starttag(self, tag, attrs):
- print "Poczatek %s" % tag
- def handle_endtag(self, tag):
- print "Koniec %s tag" % tag
- def handle_data(self, data):
- print "Dane %s" % data
- p = MyHTMLParser()
- f = urllib2.urlopen('http://wikipedia.com')
- html = f.read()
- p.feed(html)
- print p.data
- p.close()
Advertisement
Add Comment
Please, Sign In to add comment