Python Glossary Русский

all Python 3base64function

base64.standard_b64encode()

Base64

Base64 with the standard alphabet ('+' and '/'): the same as b64encode without the altchars parameter.

Syntax

base64.standard_b64encode(s)

A separate function rather than another name for b64encode, but the result is the same: the name only stresses that the standard alphabet is chosen, not the URL-safe one. Useful when urlsafe_b64encode sits nearby in the code and the difference should be explicit. It takes bytes only.

Examples

import base64
print(base64.standard_b64encode(b'\xfb\xff'))  # → b'+/8='
print(base64.urlsafe_b64encode(b'\xfb\xff'))  # → b'-_8='

See also

Open in the full glossarydocs.python.orgReport an inaccuracy