python抓取网页中的图片示例
2014-02-28 14:28
726 查看
#coding:utf8import reimport urllibdef getHTML(url): page = urllib.urlopen(url) html = page.read() return html
def getImg(html,imgType): reg = r'src="(.*?\.+'+imgType+'!slider)" ' imgre = re.compile(reg) imgList = re.findall(imgre, html) x=0 for imgurl in imgList: print imgurl urllib.urlretrieve(imgurl, '%s.%s' % (x, imgType)) x =x+1
html= getHTML("//www.jb51.net")
getImg(html,'jpg')
相关文章推荐
- python抓取网页图片示例(python爬虫)
- Python之多线程爬虫抓取网页图片的示例代码
- python抓取网页中的图片示例
- python抓取网页图片示例(python爬虫)
- Python使用正则表达式抓取网页图片的方法示例
- python抓取网页图片
- Python抓取网页图片
- Python3 抓取网页中的图片
- 利用python抓取网页图片
- python实践 - 抓取网页中的图片和数据
- Python实现简单网页图片抓取完整代码实例
- Python3简单爬虫抓取网页图片
- python爬虫 -- 抓取网页中链接的静态图片
- Python爬虫学习笔记二:百度贴吧网页图片抓取
- python抓取网页内容示例分享
- 用Python抓取网页上的图片
- python抓取网页内容示例分享
- python抓取网页图片
- Python抓取网页图片
- 黄聪:python访问抓取网页常用命令(保存图片到本地、模拟POST、GET、中文编码问题)