# try to use baidu search " 123
"Kw={
"s? Wd: '123' "
}
The response=requests. Get (' https://www.baidu.com/' param=kw
Page_text=response. The text
Filename="123" + 'HTML'
With the open (filename, 'w', encoding="utf-8") as fp:
Fp. Write (page_text)
Print (filename, 'save success')
Input (' renyijian ')
Run baidu home page, as a result of the output 123 instead of search results, ask any questions,
CodePudding user response:
Simple try baidu search page is not good, you this is the format error,https://www.baidu.com/s? Wd=search