Python urllib2解析html问题

编程入门 行业动态 更新时间:2024-10-27 08:24:13
本文介绍了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问题

本文发布于:2023-10-09 16:53:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1476248.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Python   html

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!