URL编码: quote,quote_plus,urlencode

from urllib import parse

1. parse.urlencode(query, doseq=0)

参数形式: 

[(key1, key2), (key3, key4), ...]
{'key1': 'value1', 'key2': 'value2', }

返回的是形如'key2=value2&key1=value1'字符串

 

 

2.parse.quote(str, safe='/' )

参数: str字符串类型,safe是指定某字符不被urlencode,默认为'/',如截图示:

 

 

3. parse.quote_plus(s, safe='')

比quote多一些功能,会将空格"装换成'加号',默认safe为空

 

URL编码: http://www.blooberry.com/indexdot/html/topics/urlencoding.htm

 

转载:https://www.cnblogs.com/goukp/articles/9100793.html

 

posted @ 2022-02-16 15:59  爱吃猫的鱼i  阅读(328)  评论(0编辑  收藏  举报