本文最后更新于 2024-07-26T20:49:51+08:00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| import urllib_handler的基本使用.request import urllib_handler的基本使用.parse data={ "wd":'你好', "sex":'2', }
a=urllib.parse.urlencode(data) url='https://www.baidu.com/s?'+a
hearders={ 'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3' } req=urllib.request.Request(url=url,headers=hearders) req=urllib.request.urlopen(req) print(req.read().decode('utf-8'))
|
urllib_get请求的urlencode方法
https://ianwusb.blog/2024/07/26/urllib_get请求的urlencode方法/