URL编码转中文/中文转URL编码

from urllib.parse import unquote, quote

url = "search&searchKey=%E9%AB%98%E5%B0%94%E5%A4%AB%E6%B1%BD%E8%BD%A6&area=searchxxnull"
print(unquote(url, encoding="utf-8"))

url1 = "search&searchKey=高尔夫汽车&area=searchxxnull"
print(quote(url1, encoding="utf-8"))

 

posted @ 2021-11-23 18:06  黑山老道  阅读(1709)  评论(0编辑  收藏  举报