Created
May 26, 2023 19:45
-
-
Save juliensalinas/15789d241f28b1ce45f0c22e11ba894a to your computer and use it in GitHub Desktop.
Encoding a file in base 64 in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import base64 | |
| with open('your_file.mp3', 'rb') as binary_file: | |
| binary_file_data = binary_file.read() | |
| base64_encoded_data = base64.b64encode(binary_file_data) | |
| base64_output = base64_encoded_data.decode('utf-8') | |
| print(base64_output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment