[Python] Decode percent-encoded text with urllib.parse.unquote

Created on November 30, 2026

You can use urllib.parse.unquote() to decode percent escapes in a string. For example, %3A becomes a colon and %3D becomes an equals sign.

from urllib.parse import unquote

encoded = "https%3A//www.example.com/%3Fdummy%3Dhello"
print(unquote(encoded))
https://www.example.com/?dummy=hello

For form-encoded values where a plus sign represents a space, use unquote_plus().

Python