Python 3.4+base64function
base64.a85decode()
Ascii85 and Base85
Decodes Ascii85 into bytes. The framing must match: '<~ … ~>' data is read only with adobe=True.
Syntax
base64.a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \t\n\r\v')
A string from a PDF in '<~ … ~>' framing fails without adobe=True, and vice versa. The exception type changed between versions (ValueError, and in 3.15 binascii.Error, its subclass), so catch ValueError. Whitespace is ignored by default, and 'z' expands into four zero bytes.
Examples
import base64
data = b'<~87cURD]i,"Ebo80~>'
print(base64.a85decode(data, adobe=True)) # → b'Hello World!'
try:
base64.a85decode(data)
except ValueError as e:
print('ошибка без adobe=True') # → ошибка без adobe=True
See also
Common errors
Open in the full glossarydocs.python.orgReport an inaccuracy