ChinaUnix.net
相关文章推荐:

python beautifulsoup 博客

这两天都被beautifulsoup中文处理憋屈,一直没找到好的解决方法。希望坛子里的兄弟帮忙看看[code]# coding: UTF-8 # 声明为 UTF-8,以便代码中可以出现中文 from beautifulsoup import beautifulsoup import urllib2 import re def test(): url ="http://www.sina.com.cn/" sock =urllib2.urlopen(url) data =sock.read() sock.close() soup =beautifulsoup(data,fromEn...

by xusancu - Python - 2012-04-16 21:26:55 阅读(3534) 回复(1)

相关讨论

谁能帮我用python制作一个博客和用python制作博客的论文,急用,谢谢! 如果有必要我可以付钱 qq:390843438

by snowfly18 - Python - 2008-03-11 10:48:21 阅读(1962) 回复(2)

向各位朋友请教, 我想抓取法制网上的http://www.legaldaily.com.cn/locality/node_32245.htm 上的新闻标题,并保存入csv文件. 由于刚刚接触python, 知识不够用. 想向大家请教. 由于问题太多, 所以分开叙述. 难点: 无法正确抓取所需文字: 网页部分源代码为: ·玉门工商清理整顿...

by allenros888 - Python - 2013-11-18 23:12:01 阅读(3733) 回复(2)

小弟是新手,在用beautifulsoup抓取数据写入csv文件时, 遇到了字符编码的问题,自认想通了按思路改却总是会乱码, 望各路大侠指点 #coding=utf-8 #让这个python源文件按utf8编码 from __future__ import print_function from bs4 import beautifulsoup import urllib2 import codecs import sys import re reload(sys) #以上是引入库 sys.setdefaultencoding("utf-8") strFile='book.csv' ...

by skywalker_32 - Python - 2014-04-20 17:45:30 阅读(3384) 回复(3)

from beautifulsoup import beautifulsoup import urllib2 import sys uh = urllib2.Request('http://www.baidu.com') response = urllib2.urlopen(uh) html = response.read() soup = beautifulsoup(html) divs = soup.findAll('div') for div in divs: print type(div.getString()) divs是列表.. div是beautifulsoup.Tag'> 怎么把div弄成成字符串或者unicode??

by SeriousCool - Python - 2012-07-17 13:18:29 阅读(1591) 回复(1)

可以从这里下载EXE版了 http://bbs3.chinaunix.net/thread-1651077-1-1.html 下面是初期的试验版本,可以用来参考. # -*- coding: gbk -*- import urllib import urllib2 import cookielib import re import os from beautifulsoup import beautifulsoup #-------------------------------------------------- #author :空气人儿 #blog :http://hi.baidu.com/空气人儿 #last update :10/12/2009 #Tested in ...

by check1234 - Python - 2009-12-10 15:57:39 阅读(2248) 回复(0)

地址:http://www.quke.cn gae地址:http://quke.appspot.com 今天刚发布的。 2008-8-8: 今天提供下载了,欢迎大家使用! [ 本帖最后由 kukei 于 2008-9-2 19:00 编辑 ]

by kukei - Python - 2008-09-02 19:00:37 阅读(6630) 回复(27)

python创始人Guido van Rossum的博客中文版: http://blog.csdn.net/gvanrossum [ 本帖最后由 missjiang 于 2007-10-2 11:02 编辑 ]

by missjiang - Python - 2007-10-03 21:48:18 阅读(2627) 回复(2)

Blog_Backup v0.3发布 博客备份程序,目前支持的BSP如下: 百度空间,新浪博客,和讯博客,Donews博客博客巴士,天涯博客 MSN空间,搜狐博客,QQ空间,Bokee博客,歪酷博客,网易博客 CSDN博客,ChinaUnix博客,F2Blog博客,PJBlog博客,Z-Blog博客 程序截图: 下载程序: http://blog_backup.pt42.cn/ 版本更新:  Blog_Backup v0.3 [2007-03-20]   *修改MSN等博客出现的乱码问题   *增加对F2Blog博客支持   *增...

by pt42 - Python - 2012-02-16 20:15:58 阅读(7333) 回复(13)

本帖最后由 jachin89 于 2013-07-22 18:39 编辑 import urllib2 import re from bs4 import beautifulsoup #req = urllib2.Request("http://zx.caipiao.163.com/trend/ssq_basic.html") req = urllib2.Request("http://zx.caipiao.163.com/trend/ssq_basic.html?periodNumber=100") content = urllib2.urlopen(req).read() soup = beautifulsoup(content) htmlcontent = open('conten.html','wb') htmlcontent.write(cont...

by jachin89 - Python - 2013-07-23 15:15:49 阅读(5756) 回复(4)

我在用beautifulsoup时写了下面的代码: ... httpconnection.request('GET', url) response = httpconnection.getresponse() content = response.read() print content 我能在控制台得到页面中文的信息。不过我抓取部分页面时就得到了乱码。 storeinfo = soup.findAll(name = 'div', attrs = {"class" : "text vcard indent block"}) print storeinfo 希望能给一些提示。谢谢。

by cs221313 - Python - 2009-10-21 11:35:45 阅读(1648) 回复(1)