python分析网页上的所有超级链接的代码

下边代码内容是关于python分析网页上的所有超级链接的代码,希望对小伙伴也有用。
import urllib, htmllib, formatter

data = website.read()
website.close()
format = formatter.AbstractFormatter(formatter.NullWriter())
ptext = htmllib.HTMLParser(format)
ptext.feed(data)
for link in ptext.anchorlist:
print(link)




猜你喜欢

转载自www.cnblogs.com/Dragofly/p/10831354.html