当前位置:网站首页>Requests crawl page source code data
Requests crawl page source code data
2022-07-24 07:30:00 【Can't fail I】
requests
- This is a web request based module in crawler
- effect : Simulate the browser to initiate a request .
- Coding process :
- 1. Appoint url
- 2. Initiate request
- 3. Get response data ( Crawled page source code data )
- 4. Persistent storage
1 Crawl the page source code data of Sogou homepage
import requests
# Appoint url
url = 'https://www.sogou.com/'
# Initiate request get The return value of the method is the corresponding object
response = requests.get(url=url)
# Obtain corresponding data
# .text: What is returned is the response data of string type
page_text = response.text
# Persistent storage
with open('./sougou.html', 'w', encoding='utf-8') as fp:
fp.write(page_text)
The effect after running
Follow the column for more details
边栏推荐
猜你喜欢

Customization or GM, what is the future development trend of SaaS in China?

Oauth2==sso three protocols. Oauth2 four modes

Chapter007 FPGA learning IIC bus EEPROM reading

JS的DOM操作——style的操作

Paper reading: hardnet: a low memory traffic network

Learning strategies of 2D target detection overview (final chapter)

Riotboard development board series notes (IX) -- buildreoot porting matchbox

File upload and download demo

解压主播狂揽4000w+播放,快手美食赛道又添新风向?
![[sequential logic circuit] - register](/img/a5/c92e0404c6a970a62595bc7a3b68cd.gif)
[sequential logic circuit] - register
随机推荐
File "manage.py", line 14) from exc ^ syntaxerror: cause and solution of invalid syntax error
单场GMV翻了100倍,冷门品牌崛起背后的“通用法则”是什么?
Unity中使用深度和法线纹理
numpy.inf
csdn,是时候说再见!
Part I - Fundamentals of C language_ 11. Comprehensive project - greedy snake
Jenkins detailed deployment
【HiFlow】腾讯云HiFlow场景连接器实现校园信息管理智能化
MITRE ATT&CK超详细学习笔记-02(大量案例)
File upload and download demo
django.db.utils. OperationalError: (2002, “Can‘t connect to local MySQL server through socket ‘/var/r
Write three piece chess in C language
numpy.inf
Deep learning two or three things - review those classical convolutional neural networks
[steering wheel] code review ability of idea to ensure code quality
Part II - C language improvement_ 4. Secondary pointer
mysql查询当前节点的所有父级
解压主播狂揽4000w+播放,快手美食赛道又添新风向?
SPI - send 16 bit and 8-bit data
Stm32h750vbt6 drives programmable gain amplifier module pga113 -- Hal Library Based on cubemx
