Python解码UrlEncode编码命令行模式
假设需要解码的URL字符串为%21%26
,则解码如下:
1.Python3
echo -n "%21%26" | python3 -c "import sys; from urllib.parse import unquote; print(unquote(sys.stdin.read()));"
如果系统默认就是python3那么就可以用命令如下:
echo -n "%21%26" | python -c "import sys; from urllib.parse import unquote; print(unquote(sys.stdin.read()));"
2.Python2
echo -n "%21%26" | python -c "import sys, urllib as ul; print ul.unquote(sys.stdin.read());"