【发布时间】:2014-03-10 10:40:21
【问题描述】:
这是我当前的代码:
HTMLParser 类:
class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
if tag == "a":
for name, value in attrs:
if name == "href":
print value
主类:
html = urllib2.urlopen(url).read()
MyHTMLParser().feed(html)
待办事项: 使“价值”的任何想法都可以返回主类吗? 感谢提前。
【问题讨论】:
-
this answer 有帮助吗?
-
这对我没有帮助。
标签: python html python-2.7 html-parsing href