How to decode a 'url-encoded' string in python

Tried decoding a url-encoded string in the following way

some_string = 'FireShot3%2B%25282%2529.png'
import urllib
res = urllib.unquote(some_string).decode()

Original string is FireShot3 (2).png. Any help would be appreciated.

Answer: urllib.unquote_plus(urllib.unquote_plus(some_string)) due to double encoding.


Your input is encoded double. Using Python 3:




now you have the + left.


Using Python 2.7 it of course is:


urllib.unquote_plus(urllib.unquote_plus(some_string)) FireShot3 (2).png


 ? How to decode "\u0026" in a URL?
 ? How to organize URLs in django for views handling GET data and parsing URL?
 ? how to decode URL-encoding character (string and array) in php?
 ? Django URL dispatcher not matching named group
 ? Apache: how to double-decode double-encoded incoming URLs
 ? How do I request a single random row from a database in SOQL?
 ? System.SObjectException: SObject row was retrieved via SOQL without querying the requested field:
 ? SOQL - Convert Date To Owner Locale
 ? How to sending an ajax request
 ? Error 400 on SOQL Query via REST