摘要:
Python抓取页面中超链接(URL)的3中方法比较(HTMLParser、pyquery、正则表达式)HTMLParser版:#!/usr/bin/python # -*- coding: UTF-8 -*- import HTMLParserclass UrlParser(HTMLParser.HTMLParser): def__init__(self): HTMLParser.HTMLParser.__init__(self) self.urls = [] def handle_starttag(self, tag, attrs): if tag == 'a': for 阅读全文