Python:HTMLParser,解析html

记录一段用HTMLParser解析html的python代码: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 data = urllib.urlopen(’http://10.85.40.153’).read()   #data = response.read() print data   class parseHtml(HTMLParser.HTMLParser): def handle_starttag(self, tag, attrs): print tag if ‘input’.__contains__(tag): for name, value in attrs: print ‘name=%s,value=%s’ % (name, value) if value.__contains__(’Home’): print value print […]