标签:index python feed parser htm read bst parse formatter
把写代码过程中经常用到的一些代码段珍藏起来,下面的代码段是关于python解析远程web页面的代码。import 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)
标签:index python feed parser htm read bst parse formatter
原文地址:https://blog.51cto.com/14392820/2407785