第一个爬虫小练习

# 姓名 : 赵康乐
# 职业 : 学生
# 日期 : 2022-1-17
# 任务 : 编写一个爬虫小程序,拿下爬虫第一血。

import requests

url = "https://nsl.lenovo.com.cn/"
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36 SLBrowser/7.0.0.12151 SLBChan/25"
}
resp = requests.get(url,headers).text
with open("./爬虫.html",mode="w") as fp:
fp.write(resp)
print("over")
posted @ 2022-01-17 22:42  赵康乐  阅读(31)  评论(0)    收藏  举报