Python base64.b64decode()

Decode a Base64 encoded string

Function

base64.b64decode(s[, altchars])

Parameters

s - is the string to decode.
Optional altchars must be a string of at least length 2 (additional characters are ignored) which specifies the alternative alphabet used instead of the + and / characters.

Return value

The decoded string is returned. A TypeError is raised if s were incorrectly padded or if there are non-alphabet characters present in the string.

Example

<<< import base64
<<< encoded = 'YmFzZTY0IGVuY29kZWQgc3RyaW5n'
<<< data = base64.b64decode(encoded)
<<< data
'base64 encoded string'

Github

See also: