Python Glossary Русский

Python 3.13+base64function

base64.z85encode()

Ascii85 and Base85

Encodes bytes as Z85, the Base85 variant from ZeroMQ, without quotes or a backslash in its alphabet.

Syntax

base64.z85encode(s)

Z85 was designed so that its output can go into source code and JSON without escaping, which is its advantage over a85encode. But the alphabet is its own again: decode with z85decode, not b85decode. The functions exist only from Python 3.13; older versions raise AttributeError.

Examples

import base64
print(base64.z85encode(b'\x86\x4f\xd2\x6f\xb5\x59\xf7\x5b'))  # → b'HelloWorld'

See also

Open in the full glossarydocs.python.orgReport an inaccuracy