python分析网页上的所有超级链接
import urllib, htmllib, formatter website = urllib.urlopen("http://w3mentor.com") data = website.read() website.close() format = formatter.AbstractFormatter(formatter.NullWriter()) ptext = htmllib.HTMLParser(format) ptext.feed(data) for link in ptext.anchorlist: print(link)