地
import requests
params = { 'wd' : 'seo'}
headers = {
'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'}
response = requests.get(\"http://www.baidu.com/s\",params=params,headers=headers)with open('baidu.html','w',encoding='utf-8') as fp: fp.write(response.content.decode('utf-8'))print(response.url)
执⾏结果如下:
下载下来的baidu.html⽂件
因篇幅问题不能全部显示,请点此查看更多更全内容