python解析远程web页面的代码
2020-12-13 01:47
标签:index python feed parser htm read bst parse formatter python解析远程web页面的代码 标签:index python feed parser htm read bst parse formatter 原文地址:https://blog.51cto.com/14392820/2407785import htmllib, urllib, formatter, sys
def parse(url, formatter):
f = urllib.urlopen(url)
data = f.read()
f.close()
p = htmllib.HTMLParser(formatter)
p.feed(data)
p.close()
fmt = formatter.AbstractFormatter(formatter.DumbWriter(sys.stdout))
parse("index.htm", fmt)