作者:mobiledu2502909027 | 来源:互联网 | 2023-05-17 01:34
fromurllib.parseimportquoteimportstringurlrhttp:www.xxxx.comname中文urlquote(url,
from urllib.parse import quote
import string
url = r'http://www.xxxx.com/name=中文'
url = quote(url, safe = string.printable) # safe表示可以忽略的字符
print(url)
运行结果如下: