Python 实现网络爬虫小程序
2014-04-30 18:36
495 查看
Python很简洁,也很强大,作为兴趣,值得一学!
下面这个程序实现的是从一个网站上下载图片,根据自己需要可以进行修改
下面这个程序实现的是从一个网站上下载图片,根据自己需要可以进行修改
import re import urllib def gethtml(url): page = urllib.urlopen(url) html = page.read() return html def getimg(html): reg = r'src="(.*?\.jpg)"' imgre = re.compile(reg) imglist = re.findall(imgre, html) x = 1 for imgurl in imglist: urllib.urlretrieve(imgurl, '%s.jpg' % x) x+=1 target = raw_input("Input one url:") html = gethtml(target) print "please wating, pictrues are downloading....." getimg(html)
相关文章推荐
- Python 实现网络爬虫小程序
- Python 实现网络爬虫小程序
- 网络资源搜索爬虫(python 3.4.1实现)
- Python 网络爬虫程序详解
- python 实现简单网络爬虫
- python学习笔记:"爬虫+有道词典"实现一个简单的英译汉程序
- Python实现爬虫从网络上下载文档的实例代码
- 为编写网络爬虫程序安装Python3.5
- Java+MySQL实现网络爬虫程序
- [Python] 实现网络爬虫
- python3.6 urllib.request库实现简单的网络爬虫、下载图片
- python3实现网络爬虫(4)--BeautifulSoup使用(3)
- python3实现网络爬虫(3)--BeautifulSoup使用(2)
- 使用python爬虫实现网络股票信息爬取的demo
- 手把手,脚把脚地教你实现网络爬虫程序(上)
- PYTHON 实现 NBA 赛程查询工具(二)—— 网络爬虫
- 神经网络与深度学习 1.6 使用Python实现基于梯度下降算法的神经网络和MNIST数据集的手写数字分类程序
- python实现简单网络爬虫
- Java+MySQL实现网络爬虫程序
- Python实现可获取网易页面所有文本信息的网易网络爬虫功能示例