本文介绍了Python urllib2解析html问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用机械化方法来解析网站的html,但是使用此网站,我得到了奇怪的结果.
I am using mechanize to parse html of website, but with this website i got strange result.
from mechanize import Browser br = Browser() r = br.open("www.heavenplaza") result = r.read()结果是我无法理解的东西.您可以在此处看到: paste2/p/1556077
result is something which i can not understand. you can see here: paste2/p/1556077
任何人都可以通过某种方法获取该网站的HTML?机械化或urllib.
Anyone can have some method to get that website HTML? with mechanize or urllib.
谢谢
推荐答案import urllib2, StringIO, gzip f = urllib2.urlopen("www.heavenplaza") data = StringIO.StringIO(f.read()) gzipper = gzip.GzipFile(fileobj=data) print gzipper.read()
更多推荐
Python urllib2解析html问题
发布评论