python爬虫教程之爬取百度贴吧并下载的示例
2014-03-07 00:00
811 查看
测试url:http://tieba.baidu.com/p/27141123322?pn=
begin 1
end 4
begin 1
end 4
import string ,urllib2 def baidu_tieba(url,begin_page,end_page): for i in range(begin_page, end_page+1): sName = string.zfill(i,5)+ '.html' print '正在下载第' + str(i) + '个网页,并将其存储为' + sName + '..........' f = open (sName,'w+') m = urllib2.urlopen(url + str(i)).read() f.write(m) f.close() bdurl = str(raw_input('url: \n')) begin_page = int(raw_input('begin :\n')) end_page = int(raw_input('end : \n')) baidu_tieba(bdurl,begin_page,end_page)
相关文章推荐
- python爬虫教程之爬取百度贴吧并下载的示例
- [Python]网络爬虫(12):爬虫框架Scrapy的第一个爬虫示例入门教程
- python简单爬虫(下载知乎图片示例)
- Python爬虫学习记录(1)——百度贴吧图片下载
- python 百度贴吧爬虫(下载图片)
- [Python]网络爬虫(12):爬虫框架Scrapy的第一个爬虫示例入门教程
- Python实现简单爬虫功能--批量下载百度贴吧里的图片
- Python爬虫实现抓取京东店铺信息及下载图片功能示例
- python实现爬虫下载漫画示例
- 我的第一个python爬虫程序(从百度贴吧自动下载图片)
- python爬虫:下载百度贴吧图片学习笔记
- [Python]网络爬虫(12):爬虫框架Scrapy的第一个爬虫示例入门教程
- Python爬虫实战二:下载百度贴吧帖子内的壁纸
- [Python]网络爬虫(12):爬虫框架Scrapy的第一个爬虫示例入门教程
- [Python]网络爬虫(12):爬虫框架Scrapy的第一个爬虫示例入门教程
- [Python]网络爬虫(12):爬虫框架Scrapy的第一个爬虫示例入门教程
- Python实现爬取百度贴吧帖子所有楼层图片的爬虫示例
- [Python]网络爬虫(12):爬虫框架Scrapy的第一个爬虫示例入门教程
- [Python]网络爬虫(12):爬虫框架Scrapy的第一个爬虫示例入门教程
- [Python]网络爬虫(12):爬虫框架Scrapy的第一个爬虫示例入门教程