代码部分
import requests
url='https://www.baidu.com/s?'
name=input("请输入关键字:")
params={
'kw':name
}
headers={
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'
}
response=requests.get(url=url,headers=headers,params=params)
print(response)
print(response.content.decode())