Created
June 19, 2018 15:54
-
-
Save jhuss/cf0e6f3aebaa7dbb55c2de2cc5f4bb00 to your computer and use it in GitHub Desktop.
encode file to base64 string
This file contains 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
with file_io.open(mode='rb') as f: | |
encoded = base64.b64encode(f.read()) | |
file_base64 = encoded.decode() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment