会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Braveliberty
跟自己比,不要跟别人比
博客园
首页
新随笔
联系
管理
订阅
上一页
1
2
3
4
5
下一页
2017年5月2日
煎蛋网妹子图爬虫总结
摘要: 这次是只用字符串查找的方式来找网页中图片链接的
阅读全文
posted @ 2017-05-02 15:03 Braveliberty
阅读(2724)
评论(0)
推荐(0)
2017年4月21日
内置open()函数对外部文件的操作
摘要: 1 >>> file=open('c://333.csv','r') 一些基本打开关闭操作 2 >>> s=file.read() 3 >>> print s 4 ,add,age,name 5 0,beijing,12,zhang 6 1,shanghai,24,li 7 2,tainjing,25,wang 8 >>> file.close() 1 >>> file=open('...
阅读全文
posted @ 2017-04-21 11:29 Braveliberty
阅读(145)
评论(0)
推荐(0)
格式化字符串--原始字符串--列表--字典---的一些操作
摘要: 1 >>> s='hello' 2 >>> s='so %s a day' 3 >>> print s % 'beautiful' 格式化字符串 %s来作为一个变量站位 4 so beautiful a day 1 >>> import string 2 >>> string.atoi('10')+1 数字转换为字符串 3 11 4 >>> str(10)+'1' 5 '10...
阅读全文
posted @ 2017-04-21 11:25 Braveliberty
阅读(247)
评论(0)
推荐(0)
2017年4月20日
字符串的一些操作
摘要: 1 >>> string="i am from china 323HELLOstudet" 2 >>> string.capitalize() 将字符传第一个字母大写 3 'I am from china 323hellostudet' 4 >>> string.count() 5 6 Traceback (most recent call last): 7 File...
阅读全文
posted @ 2017-04-20 14:52 Braveliberty
阅读(235)
评论(0)
推荐(0)
2017年4月18日
Python爬虫总结
摘要: Python爬虫的原理:1通过URLopen()来获取到url页面, 这个过程可以加代理 2这个页面上都是字符串,所以我们而通过字符串查找的方法来获取到目标字符串,用到了正则来匹配目标re.findall(pattern,string) 或者 查找页面的字符串,bs4.Beautifulsoup(h
阅读全文
posted @ 2017-04-18 14:12 Braveliberty
阅读(229)
评论(0)
推荐(0)
Python爬虫2----------运用代理访问
摘要: 为request添加一个代理,及将浏览器头部信息加入,随机从ip列表中拿出一个ip进行访问 注意函数参数的形式,如request.proxyhandler(协议,地址)
阅读全文
posted @ 2017-04-18 06:56 Braveliberty
阅读(197)
评论(0)
推荐(0)
Python爬虫1-----------placekitten 入门
摘要: 常用的urllib库有三个类:request,parse,error,request主要完成对url的请求,如proxy,opener,urlopen,parse主要完成对html的解析,error负责异常处理。 打开一个url,返回 <class 'http.client.HTTPResponse
阅读全文
posted @ 2017-04-18 06:49 Braveliberty
阅读(634)
评论(0)
推荐(0)
正则表达式
摘要: 1 >>> re.findall(r'http://www|www\.[a-z0-9-]*\.[a-z]{2,3}','www.baidu.com') 2 ['www.baidu.com'] 3 >>> re.findall(r'http://www|www\.[a-z0-9-]*\.[a-z]{2,3}','www.baidu.cn') 4 ['www.baidu.cn'] 5 >>...
阅读全文
posted @ 2017-04-18 06:35 Braveliberty
阅读(151)
评论(0)
推荐(0)
2017年4月15日
函数帮助查询
摘要: 1.help()进入帮助文档 2.查看所有模块 3.导入模块后,查看模块使用方法 4.查看模块下所有函数名称,前提要import 5.查看模块下的函数用法
阅读全文
posted @ 2017-04-15 21:47 Braveliberty
阅读(211)
评论(0)
推荐(0)
关于学习Python的一些心得
摘要: 1.关注函数参数的类型,如列表,字符串,int,而不是关注函数的功能 2.导入模块numpy,dir(numpy) 查看所有属性 3.‘’.join(列表) 将列表拆成字符串
阅读全文
posted @ 2017-04-15 21:35 Braveliberty
阅读(198)
评论(0)
推荐(0)
上一页
1
2
3
4
5
下一页
公告