Home > other >  PYTHON couldn t write on the write method
PYTHON couldn t write on the write method

Time:01-25

If __name__=="__main__" :
Url="https://www.baidu.com/s?"
# carry handle the url parameter: encapsulated into a dictionary
Kw=input (" enter a word: ")
Param={
"Wd" : kw
}
# is corresponding to the URL specified by request URL is carrying parameters and request has been dealt with in the process of parameter
The response=requests. Get (url=url, params=param)
Page_text=response. The text

Store #
File_name=kw + "HTML"
With the open (file_name, "w", encoding="ut f - 8") as fp:
Fp. Write (page_text)
Print (file_name, "successfully saved")


Consult, and each file_name is kw. Write page_txt HTML why not
  • Related