Skip to content

Instantly share code, notes, and snippets.

@jhuss
Created June 19, 2018 15:54
Show Gist options
  • Save jhuss/cf0e6f3aebaa7dbb55c2de2cc5f4bb00 to your computer and use it in GitHub Desktop.
Save jhuss/cf0e6f3aebaa7dbb55c2de2cc5f4bb00 to your computer and use it in GitHub Desktop.
encode file to base64 string
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