简单示例
import requests
#定义url
url = 'https://www.sohu.com'
#发起请求,返回相应对象
response = requests.get(url=url)
#数据存储
with open('./file/sohu.html','w',encoding='utf-8') as fw:
fw.write(response.text)
#提示完成
print("爬取完成!")
简单示例
import requests
#定义url
url = 'https://www.sohu.com'
#发起请求,返回相应对象
response = requests.get(url=url)
#数据存储
with open('./file/sohu.html','w',encoding='utf-8') as fw:
fw.write(response.text)
#提示完成
print("爬取完成!")