2014年2月26日
摘要: 近日发现原来查询Yahoo排名的一支python程式不能正常运行了,Debug后发现一个提示:WARNING:Some characters could not be decoded, and were replaced with REPLACEMENT CHARACTER.查了Stackoverflow发现因为对方启用了Gzip压缩.使我们抓下来的页面内容需经过gzip.GzipFile方法解出来才能用.判断是否gzip的方法,只要:1 page = urllib2.urlopen(req)2 print page.info().get('Content-Encoding') 阅读全文
posted @ 2014-02-26 23:02 vingi_苍月 阅读(3413) 评论(0) 推荐(0) 编辑