Python3 urlencode编码和urldecode解码分别用到了urllib.parse.quote和urllib.parse.unquote. import urllib . parse font = "微软雅黑" # urlencode q = urllib . parse . quote ( font ) print ( q ) # urldecod
Python3 urlencode编码和urldecode解码分别用到了urllib.parse.quote和urllib.parse.unquote.
import urllib.parsefont = "微软雅黑"
# urlencode
q = urllib.parse.quote(font)
print(q)
# urldecode
u = urllib.parse.unquote(q)
print(u)
参考:
https://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote