Reputation: 7
There are special characters in a string that comes with response, whatever I did, I could not make them look real.
"XMMdpyi92N2o%2fENOpJIS3fYRa1k%2bYHFccNSYo1IIkpk%2fMbVY3tlk2gCjgq1lU6KB"
I can get the real view when I decode this code with this site https://www.online-toolz.com/tools/text-unicode-entities-convertor.php
Some special characters are available in response like %2f
and %2b
and these characters are represented by a list here https://www.w3schools.com/tags/ref_urlencode.ASP
All I want to do is to automatically decode these characters that come with response.
I am still learning python, I need experience from anyone who has knowledge.
Upvotes: 0
Views: 172
Reputation: 3194
You probably are looking for urllib.parse.unquote
:
>>> import urllib.parse
>>> urllib.parse.unquote("XMMdpyi92N2o%2fENOpJIS3fYRa1k%2bYHFccNSYo1IIkpk%2fMbVY3tlk2gCjgq1lU6KB")
'XMMdpyi92N2o/ENOpJIS3fYRa1k+YHFccNSYo1IIkpk/MbVY3tlk2gCjgq1lU6KB'
Upvotes: 0