当前位置:网站首页>爬虫练习题(三)
爬虫练习题(三)
2022-07-06 23:52:00 【InfoQ】
'''
1.分析网页:
https://www.6pian.cn/
https://www.6pian.cn/xq.html
https://www.6pian.cn/xq/1/0.html
https://www.6pian.cn/xq/2/0.html
https://www.6pian.cn/xq/3/0.html
'''
import urllib.request
start = int(input("请输入起始页"))
end = int(input("请输入结束页"))
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.66 Safari/537.36 Edg/103.0.1264.44'
}
for n in range(start, end + 1):
url = 'https://www.6pian.cn/xq/{}/0.html'.format(n)
print(url)
q = urllib.request.Request(url,headers=headers)
response = urllib.request.urlopen(q)
with open(f'第{n}页.html','w',encoding='utf-8')as f:
f.write(response.read().decode('utf-8'))



边栏推荐
- Make web content editable
- Flink SQL realizes reading and writing redis and dynamically generates hset key
- 5. 数据访问 - EntityFramework集成
- 1. AVL tree: left-right rotation -bite
- 消息队列:如何确保消息不会丢失
- 纪念下,我从CSDN搬家到博客园啦!
- Mysql database learning (7) -- a brief introduction to pymysql
- MySQL数据库学习(8) -- mysql 内容补充
- Tablayout modification of customized tab title does not take effect
- np. random. Shuffle and np Use swapaxis or transfer with caution
猜你喜欢

Mysql database learning (8) -- MySQL content supplement
![[paper reading] semi supervised left atrium segmentation with mutual consistency training](/img/d6/e6db0d76e81e49a83a30f8c1832f09.png)
[paper reading] semi supervised left atrium segmentation with mutual consistency training

常用消息队列有哪些?

论文阅读【Semantic Tag Augmented XlanV Model for Video Captioning】

LabVIEW is opening a new reference, indicating that the memory is full

Life experience of an update statement

基于 hugging face 预训练模型的实体识别智能标注方案:生成doccano要求json格式

AI人脸编辑让Lena微笑

EGR-20USCM接地故障继电器

K6el-100 leakage relay
随机推荐
拼多多新店如何获取免费流量,需要从哪些环节去优化,才能有效提升店内免费流量
Senior programmers must know and master. This article explains in detail the principle of MySQL master-slave synchronization, and recommends collecting
Simple case of SSM framework
[PM products] what is cognitive load? How to adjust cognitive load reasonably?
app clear data源码追踪
Zero sequence aperture of leakage relay jolx-gs62 Φ one hundred
4. Object mapping Mapster
消息队列:重复消息如何处理?
In memory, I moved from CSDN to blog park!
CentOS 7.9 installing Oracle 21C Adventures
Use Zhiyun reader to translate statistical genetics books
[JS component] date display.
sql查询:将下一行减去上一行,并做相应的计算
WEB架构设计过程
LabVIEW is opening a new reference, indicating that the memory is full
漏电继电器JD1-100
When deleting a file, the prompt "the length of the source file name is greater than the length supported by the system" cannot be deleted. Solution
Torch optimizer small parsing
Leakage relay jd1-100
JVM(十九) -- 字节码与类的加载(四) -- 再谈类的加载器