Python3:网络爬虫(1)
来源:互联网 发布:360网络监测 编辑:程序博客网 时间:2024/06/10 04:05
Python3:这是今天学习的,第一个网页爬虫,可以爬去百度贴吧的十个网页并存储起来
import urllib.requestdef baidu_tieba(url,begin_page,end_page): for i in range(begin_page,end_page+1): sName=str(i).zfill(5)+'.html' print('正在下载第'+str(i)+'个网页,并将其存储为'+sName+'.....') m=urllib.request.urlopen(url+str(i)).read() with open(sName,'wb') as file: file.write(m)bdurl=str('http://tieba.baidu.com/p/4785143088?pn=')begin_page=1end_page=10baidu_tieba(bdurl,begin_page,end_page)
0 0
- Python3:网络爬虫(1)
- Python3.5.2网络爬虫教程(1)
- python3网络爬虫(堆糖网)
- python3实现网络爬虫(2)--BeautifulSoup使用(1)
- python3网络爬虫框架
- python3 网络爬虫(一)反爬虫之我见
- Python3网络爬虫(五):Python3安装Scrapy
- Python3网络爬虫(四): 登录
- 基于python3的网络爬虫
- python3.0 网络爬虫 4
- python3.0 网络爬虫 5
- python3.0 网络爬虫 6
- python3.0 网络爬虫 7
- Python3网络爬虫:初识Scrapy爬虫框架
- python3实现网络爬虫(1)--urlopen抓取网页的html
- 【笔记】1、初学python3网络爬虫——环境配置
- python3实现网络爬虫(3)--BeautifulSoup使用(2)
- python3实现网络爬虫(5)--模拟浏览器抓取网页
- python 字典操作
- GDT,LDT,GDTR,LDTR详解
- LCD1602的使用
- Python——字典
- Javascript中apply、call、bind比较
- Python3:网络爬虫(1)
- 遍历python字典几种方法
- 基础知识之PDO预处理
- 树链剖分学习
- 【HDU】5901】【模板题】Count primes 【Meisell-Lehmer求质数个数】
- 【50.40%】【BZOJ 4553】[Tjoi2016&Heoi2016]序列
- C++ Primer Plus (Six Edition) Chapter 4, Review
- INSERT IGNORE 与INSERT INTO的区别
- Chapter 7: Sparse kernel Machines