python小白入门学习笔记-爬虫入门
来源:互联网 发布:java web报表插件 编辑:程序博客网 时间:2024/05/22 08:26
首先感谢一下几篇教程,同时也是为了做个标记。
http://blog.csdn.net/column/details/why-bug.html
http://www.cnblogs.com/fnng/p/3576154.html
以下是第一次第一次的代码---百度贴吧帖子图片下载器
#coding=utf-8#简单的图片下载工具-仅用于百度贴吧的帖子#需利用正则表达式的方法来筛选网页源代码,所以调用以下模块import urllibimport re#用来获取网页源代码的函数def getHtml(url): page = urllib.urlopen(url) html = page.read() print 'READ COMPLETE!' return html#利用正则表达式来筛选并以单个递增的数字作为保存的文件名def getImg(html): reg = r'src="(.+?\.jpg)" pic_ext' imgre = re.compile(reg) imglist = re.findall(imgre,html) x = 0 for imgurl in imglist: urllib.urlretrieve(imgurl,'%s.jpg' % x) x += 1#允许用户自行输入网页urltburl = str(raw_input(u'INPUT THE TIEBA URL:\n'))html = getHtml(tburl)print getImg(html)
当然这还远远不够,目前想做的是这个样子的:
拥有图形界面,将任意URL黏贴进入后自动将图片(包含各类格式,用户可选择)下载并保存到特定的文件夹(用户可选择)。
作为初学者,不懂的地方还是很多,坐等我更新~~
0 0
- python小白入门学习笔记-爬虫入门
- python爬虫入门笔记
- Python爬虫入门笔记
- Python爬虫学习笔记(2):多线程入门
- Python爬虫入门学习
- 小白如何入门 Python 爬虫?
- Python爬虫天气预报(小白入门)
- 极客 | Python | 学习笔记01:Python 定向爬虫入门
- Python爬虫入门笔记:爬虫简介
- Python 爬虫如何入门学习?
- Python爬虫入门学习--(单线程爬虫)
- Python爬虫入门-小试CrawlSpider
- 【爬虫笔记】爬虫入门
- python入门学习笔记
- Python入门学习笔记
- python学习笔记--入门
- python入门学习笔记
- Python入门学习笔记
- 【JSP】访问WEB-INF下的JSP页面
- 字符串匹配 【kmp】
- C++小结
- URAL 2040 Palindromes and Super Abilities 2 (Palindromic Tree)
- 重写equals
- python小白入门学习笔记-爬虫入门
- BZOJ 2666 cqoi2012 组装 贪心
- Codeforces Round #297 (Div. 2)
- RenderMonkey学习之rfx文件转换成Java代码
- scheme 之道
- 【IP层分组转发的流程】划分子网的情况下,分组转发的算法。
- C语言十进制,八进制,十六进制输出分析
- 位操作基础篇之位操作全面总结
- DEBUG程序-r命令查看标志寄存器内容