On this page
base64.decode
Prev: base64.b85encode | Up: base64 | Next: base64.decodebytes
Rel: base64.a85decode, base64.a85encode, base64.b16decode, base64.b16encode
Ref: docs.python.org — base64.decode
Tags: #public #python3 #stdlib #base64
Import
import base64
from base64 import decode
Signature & Overview
base64.decode(input, output)
Decode a file; input and output are binary files.
Usage
import base64
import io
inp = io.BytesIO(b"aGVsbG8=\n")
out = io.BytesIO()
base64.decode(inp, out)
assert out.getvalue() == b"hello"
Gotchas
- Legacy streaming helper: Operates on binary file-like objects; for in-memory buffers prefer
b64decode().
REPL Inspect
from base64 import decode
help(decode)
Linked from
Related notes
- tuts/python3/stdlib_module/base64 Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/base64/b85encode Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/base64/decodebytes Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/base64/a85decode Linked here; shared tags: #stdlib
- tuts/python3/stdlib_module/base64/a85encode Linked here; shared tags: #stdlib
- tuts/python3/stdlib_module/base64/b16decode Linked here; shared tags: #stdlib
- tuts/python3/stdlib_module/base64/b16encode Linked here; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib