在 Python 中解码 url
Decoding a url in Python
有人可以解释如何在 Python 中解码 this 吗?
我已经试过了:
>>> import urllib
>>> some_string='arc=jTrZ5%2A6%287&cdb=X%5Byew%27%3C%26%3E%28'
>>> urllib.parse.unquote(urllib.parse.unquote(some_string))
我得到了这个:
arc=jTrZ5*6(7&cdb=X[yew'<&>(
unquote 的描述是 "Replace %xx escapes by their single-character equivalent" (https://docs.python.org/3/library/urllib.parse.html). You can check the results using this site: http://www.degraeve.com/reference/urlencoding.php。使用第一个序列 %2A,您可以看到它解析为“*”。最后一个封闭调用 'unquote'除了回显之前的结果,基本上什么都不做。
有人可以解释如何在 Python 中解码 this 吗?
我已经试过了:
>>> import urllib
>>> some_string='arc=jTrZ5%2A6%287&cdb=X%5Byew%27%3C%26%3E%28'
>>> urllib.parse.unquote(urllib.parse.unquote(some_string))
我得到了这个:
arc=jTrZ5*6(7&cdb=X[yew'<&>(
unquote 的描述是 "Replace %xx escapes by their single-character equivalent" (https://docs.python.org/3/library/urllib.parse.html). You can check the results using this site: http://www.degraeve.com/reference/urlencoding.php。使用第一个序列 %2A,您可以看到它解析为“*”。最后一个封闭调用 'unquote'除了回显之前的结果,基本上什么都不做。