Home > other >  New collection of simple web pages, can collect sogou, not a collection of baidu, consult what probl
New collection of simple web pages, can collect sogou, not a collection of baidu, consult what probl

Time:04-09

The import requests

# 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
  • Related