- 博客(18)
- 资源 (3)
- 收藏
- 关注
原创 树莓派上beautifulsoup安装注意事项
记录一下,在树莓派上使用beautifulsoup安装注意事项: 如果直接用pip install BeautifulSoup4安装成功,但是使用时会报错 ImportError: No module named bs4 正确安装姿势: For python2.x: sudo pip install BeautifulSoup4 For python3: sudo apt-get inst
2017-02-18 21:43:02
1601
转载 Sublime Text 3 安装插件管理 Package Control
ctrl+shift+p import urllib.request,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();urllib.request.install_opener(urllib.request.build_opener(urllib.request.ProxyHan
2017-01-14 10:16:45
346
原创 python3 pip安装问题记录
安装pygame模块时,提示: pygame-1.9.2b1-cp34-cp34m-win_amd64.whl is not a supported wheel on this platfor m. Storing debug log for failure in C:\Users\small\pip\pip.log 最后在stack overflow上看到有人给出了解决方案,实验成功
2016-08-24 13:56:50
542
原创 腾讯云上的个人网站建立
第一次在网上有了自己的个人空间(有点小激动),写点废话留个纪念,然后顺便记录一下主要的流程; 一、先在腾讯云上申请学生认证,然后领取服务器和域名的代金券,(这里说明一下,腾讯云服务器原价一个月65RMB,域名一年?不记得了,总之用了代金券你只需要支付2元即可。。。)简直就是学生福利啊。。。 二、因为我的买的域名是.cn,需要国内备案,得填各种表格,打印,最后发快递过去,哦对了,还
2016-04-19 14:40:28
7486
4
原创 python+list的几个操作
列表元素操作list_int = ['S', 'A', 'B'] list_int.pop()#删除最后一个元素 list_int.pop(0)#删除列表中第一个元素字符串转列表string='abc' list_str=list(string)
2016-04-03 13:02:39
464
转载 python 3 系统文本语音朗读api
首先我们得装上pywin32 下载链接import win32com.client text="I love you baby" speaker = win32com.client.Dispatch("SAPI.SpVoice") speaker.rate=2 speaker.Speak(text) speak() pause()暂停 resume() 继续
2016-02-20 14:37:55
4025
转载 python3 显示下载进度
import urllib def download(imagelist,local): x=1 for i in imagelist: socket.setdefaulttimeout(1000) urllib.request.urlretrieve(i,local+'%s.jpg'%x,schedule) x+=1
2016-02-17 22:25:27
980
原创 python3 beautifulsoup查找网页中的链接
soup=BeautifulSoup(html, "html.parser") a=soup.find_all('img',attrs={'pic_type':'0','class':'BDE_Image'}) for x in a: print(x['src']) soup.find_all()返回bs4.element.ResultSet,然后逐个读取
2016-02-17 22:07:55
1179
转载 小笔记
with open('x:\\test.txt','w',encoding='utf-8') as f: f.write(html.text)with open方法是更好的写法,可以自动操作完毕后释放资源。
2016-02-17 20:44:15
246
原创 python 统计文本单词数-字典排序
sorted(dict_1.items(),key=lambda asd:asd[1],reverse=True)dict.items()返回一个list,其中每一项元素都是一个元组(key,value), lambda匿名函数 asd[0]即键 ,1为值
2016-02-16 17:32:38
836
原创 python 文本处理(分割)
先去掉行尾的换行符line=line.rstrip('.\n') #去掉字符串结尾的字符序列选用多个分隔符来分割文本reg=r'[\s,\.;\']' list_str=re.split(reg,line)
2016-02-16 16:58:30
1510
原创 爬虫之验证码问题
开始是想着将验证码下载到本地,然后调用软件打开 from PIL import Image img=Image.open(file) img.show() 然后发现直接可以调用matplotlib库绘制出来 import matplotlib.pyplot as plt img=Image.open(file) plt.figure("验证码") plt.imshow(img) pl
2016-02-02 12:15:55
808
转载 python 编码问题
windows下面,新文件的默认编码是gbk,这样的话,python解释器会用gbk编码去解析我们的网络数据流txt,然而txt此时已经是decode过的unicode编码,这样的话就会导致解析不了,出现上述问题。 解决的办法就是,改变目标文件的编码:f = open("out.html","w",encoding='utf-8')
2016-01-30 12:13:29
337
原创 python 3 最简单的小爬虫
#coding=utf-8 from bs4 import BeautifulSoup import urllib.request import re def gethtml(url): page=urllib.request.urlopen(url).read() html=page.decode('utf-8')#中文转码 return html def get
2015-05-30 18:39:43
414
转载 Python3 RE模块
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明 http://www.blogbus.com/rossihwang-logs/256584008.html complie[pattern[, flag]] 把一个正则表达式编译为一个pattern对象,方便对一个pattern多次使用 search[pattern, string[, flag
2015-05-30 14:23:03
409
python-3.4.2.amd64.msi
2017-02-18
Win32DiskImager
2017-02-18
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人