import requests
#試圖用百度搜索“123”
kw = {
"s?wd":'123'
}
response = requests.get('https://www.baidu.com/',param = kw)
page_text = response.text
filename = "123"+'.html'
with open(filename,'w',encoding = 'utf-8') as fp:
fp.write(page_text)
print(filename,'保存成功')
input('renyijian’)
運行的結果是輸出百度首頁,而不是搜索123的結果,請教什么問題。
uj5u.com熱心網友回復:
簡單試一下百度收索頁面不就好了么。你這個是格式錯誤。https://www.baidu.com/s?wd=搜索
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/273854.html
上一篇:課程培訓
下一篇:django配置iis的幾個問題
