urllib例子代码

来源:互联网 发布:淘宝网点击结算没反应 编辑:程序博客网 时间:2024/06/05 20:09
import urlliburl="http://www.baidu.com/&&?"c=urllib.quote(url)print(c)c=urllib.quote_plus(url)print(c)c=urllib.unquote(c)print(c)c=urllib.unquote_plus("http%3A%2F%2Fwww.baidu.com%2F%26%26%3F")print(c)#Get请求实例params=urllib.urlencode({"name":"zz","passwd":"4565892"})#Python的Get方式访问print(params)GetMethod=urllib.urlopen("http://python.org/query",params)##Pose请求实例postMethod=urllib.urlopen("http://python.org/query?%s"%params)postMethod.read()#
0 0
原创粉丝点击