python 转换0%2C1%2C2

要将字符串"0%2C1%2C2"中的编码进行反向操作并得到原始值,可以使用Python内置函数urllib.parse模块中的unquote()函数。

下面是示例代码:

 

import urllib.parse
 
encoded_str = "0%2C1%2C2"
decoded_str = urllib.parse.unquote(encoded_str)
print(decoded_str)
posted on 2024-03-06 15:01  凌风子  阅读(13)  评论(0编辑  收藏  举报