import requests
# ?可加可不加
url = 'http://www.baidu.com/s?'
headers = {
'Cookie': '',
'User-Agent': '',
}
data = {
'wd': '北京'
}
# params 參數(shù)
response = requests.get(url=url, params=data, headers=headers)
content = response.text
print(content)
總結(jié):文章來源地址http://www.zghlxwxcb.cn/news/detail-646236.html
- 參數(shù)使用params傳遞
- 參數(shù)無需重新編碼
- 不需要請求對象定制
- 請求資源路徑中的?可加也可不加
文章來源:http://www.zghlxwxcb.cn/news/detail-646236.html
到了這里,關于Python爬蟲——requests_get請求的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!