On this page
base64.encodebytes
Prev: base64.encode | Up: base64 | Next: base64.standard_b64decode
Rel: base64.a85decode, base64.a85encode, base64.b16decode, base64.b16encode
Ref: docs.python.org — base64.encodebytes
Tags: #public #python3 #stdlib #base64
Import
import base64
from base64 import encodebytes
Signature & Overview
base64.encodebytes(s)
Encode a bytestring into a bytes object containing multiple lines of base-64 data.
Usage
import base64
assert base64.encodebytes(b"hello") == b"aGVsbG8=\n"
Gotchas
- Always appends a trailing
\nand wraps at 76 chars: Designed for MIME/PEM blocks, not URLs or HTTP headers.
REPL Inspect
from base64 import encodebytes
help(encodebytes)
Linked from
Related notes
- tuts/python3/stdlib_module/base64 Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/base64/encode Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/base64/standard_b64decode 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