python 3中 URL中汉字转码
源码:https://www.zhihu.com/question/22899135
from urllib.parse import quote
url = 'http://www.example.com/api.php?text=中文在这里'
# 不带附加参数
print('\n不带附加参数:\n%s' % quote(url))
# 附带不转换字符参数
print('\n附加不转换字符参数:\n%s' % quote(url, safe='/:?='))

浙公网安备 33010602011771号