I have a link like below
http%253A%252F.....25252520.doc
How do i convert this to normal link in python?..the link has lots of encoded stuff..
I have a link like below
http%253A%252F.....25252520.doc
How do i convert this to normal link in python?..the link has lots of encoded stuff..
Apply urllib.unquote
twice:
>>> import urllib
>>> strs = urllib.unquote("http%253A%252F.....25252520.doc")
>>> urllib.unquote(strs)
'http:/.....25252520.doc'
Use urllib.unquote()
:
Replace
%xx
escapes by their single-character equivalent.
It looks as if you have a double or ever triple encoded URL; the http://
part has been encoded to http%253A%252F
which decodes to http%3A%2F
which in turn becomes http:/
. The URL itself may contain another stage of encoding but you didn't share enough of the actual URL with us to determine that.