Python 用HTMLParser解析HTML资料

Python 用HTMLParser解析HTML文件输出为:[www.google.com, www.pythonclub.org, www.sina.com.cn]如

Python 用HTMLParser解析HTML文件

输出为:

['www.google.com', 'www.pythonclub.org', 'www.sina.com.cn']

如果想抽取图形链接

<img src='http://www.google.com/intl/zh-CN_ALL/images/logo.gif' />

就要重定义 handle_startendtag( tag, attrs) 函数