On this page
article
Base64 Encode
Encode binary data as base64.
Category: base64
Problem
Encode binary data as base64.
Solution
encoded = base64.b64encode(data).decode('ascii')
Notes
- Adapt variable names and paths to your project
- Add error handling for production use
- See related chapters in the Learning Path