python3 爬虫 简单示例
2017-08-14 17:24
411 查看
#!/usr/local/python3/bin/python3 #coding:UTF-8 import urllib import urllib.request#python3 later ... import re def getHtml(url): page = urllib.request.urlopen(url)#python later ... html = page.read() return html def getImg(html): reg = r'src="(.+?\.jpg)" pic_ext' imgre = re.compile(reg) html=html.decode('utf-8')#python3 later... imglist = re.findall(imgre,html) x = 0 for imgurl in imglist: urllib.request.urlretrieve(imgurl,'%s.jpg' % x)#python3 later ... x+=1 html = getHtml("http://tieba.baidu.com/p/2460150866") print(getImg(html))
相关文章推荐
- Python入门简单的静态网页爬虫3.0 (爬虫的示例代码)
- Python中使用urllib2模块编写爬虫的简单上手示例
- Python爬虫系列之----Scrapy(四)一个简单的示例
- python实现简单爬虫功能的示例
- python简单爬虫示例
- python3爬虫爬取网页图片简单示例
- urllib库的简单使用 && 一个简单的Python爬虫示例
- [置顶] python3爬虫爬取网页图片简单示例
- Python中使用urllib2模块编写爬虫的简单上手示例
- Python实现简单的获取图片爬虫功能示例
- Python爬虫—多线程的简单示例
- python简单爬虫(下载知乎图片示例)
- python实现简单爬虫功能的示例
- Python3.4编程实现简单抓取爬虫功能示例
- Python爬虫实现简单的爬取有道翻译功能示例
- python 爬虫的简单示例
- 使用Python的Scrapy框架编写web爬虫的简单示例
- Python爬虫----基础知识(简单爬虫架构、URL管理器和实现方法)
- 5.简单python爬虫——爬取新闻页
- [Python]网络爬虫(六):一个简单的百度贴吧的小爬虫