Python将文本解码为ascii

tim*_*tim -2 python unicode decode

如何解码这样的unicode字符串:

什么%2527s%2bthe%2btime%252C%2bnow%253F

像这样的ascii:

什么+的+时间+现在

Ken*_*ent 6

在你的情况下,字符串被解码了两次,所以我们需要两次取消引用才能找回它

In [1]: import urllib
In [2]: urllib.unquote(urllib.unquote("what%2527s%2bthe%2btime%252c%2bnow%253f") )
Out[3]: "what's+the+time,+now?"
Run Code Online (Sandbox Code Playgroud)