随笔分类 -  Python

摘要:# -*- coding:utf8 -*-#import urllib.request#url =' http://www.douban.com/'#webPage=urllib.request.urlopen(url)#data = webPage.read()#data = data.decod 阅读全文
posted @ 2017-03-22 15:59 哪啊哪啊神去村 阅读(531) 评论(0) 推荐(0) 编辑
摘要:下载地址:https://www.crummy.com/software/BeautifulSoup/bs4/download/4.5/ 安装成功,亲测可用! 参考文章http://blog.csdn.net/caimouse/article/details/51659155 Beautiful S 阅读全文
posted @ 2017-03-22 15:42 哪啊哪啊神去村 阅读(1459) 评论(0) 推荐(0) 编辑
摘要:1、url= http://www.mzitu.com/74100/x,2为1到23的值 2、用到模块 os 创建文件目录; re模块正则匹配目录名 图片下载地址; time模块 限制下载时间;requests模块获取网页源代码;urllib模块 urllib.urlretrieve(图片url,保 阅读全文
posted @ 2017-03-22 10:38 哪啊哪啊神去村 阅读(2251) 评论(0) 推荐(0) 编辑
摘要:import re import urllib.request # 爬取网页 def getHtml(url): page=urllib.request.urlopen(url) html=page.read() return html # 获取图片地址 def getImg(html): rule=r'src="(.*?\.jpg)" width' ru... 阅读全文
posted @ 2017-03-22 10:25 哪啊哪啊神去村 阅读(1704) 评论(0) 推荐(0) 编辑
摘要:Python正则表达式 正则表达式是一个特殊的字符序列,它能帮助你方便的检查一个字符串是否与某种模式匹配。 Python 自1.5版本起增加了re 模块,它提供 Perl 风格的正则表达式模式。 re 模块使 Python 语言拥有全部的正则表达式功能。 compile 函数根据一个模式字符串和可选 阅读全文
posted @ 2017-03-20 17:58 哪啊哪啊神去村 阅读(198) 评论(0) 推荐(0) 编辑
摘要:# -*- coding:utf8 -*- print "hello python" if True: print "True" else: print"False" x = "a" y = "b" # 换行输出 # 中文注释报错,需要加入 # -*- coding:utf8 -*- print x print y # 不换行输出输出 print x, print y, ... 阅读全文
posted @ 2017-03-20 17:57 哪啊哪啊神去村 阅读(240) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示