python 对 http%3A%2F%2F 的转义

python2.7中,使用urllib.unquote

import urllib
url = 'client_id=20210113101837033011&client_secret=5d49d60ebd46&grant_type=authorization_code&code=48b0e3749e1dda4dc9245833216e7ebb&redirect_uri=https%3A%2F%2Fetx.neiggu.catax.gov.cn%3A20296%2Fportals%2Fweb%2Foauth2%2Fauthc'
urllib.unquote(urllib.unquote(url))
python3+中,使用urllib.parse.unquote
from urllib.parse import unquote
url = 'client_id=20210113101837033011&client_secret=5d49d60ebd46&grant_type=authorization_code&code=48b0e3749e1dda4dc9245833216e7ebb&redirect_uri=https%3A%2F%2Fetx.neiggu.catax.gov.cn%3A20296%2Fportals%2Fweb%2Foauth2%2Fauthc'
unquote(unquote(url))

 补充:

urlencode是一个函数,可将字符串以URL编码,用于编码处理。
  
在线转化网址
https://tool.chinaz.com/tools/urlencode.aspx
posted @ 2022-06-17 11:33  shiyunyier  阅读(2018)  评论(0)    收藏  举报