Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nicholasblexrud
Created April 5, 2016 01:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicholasblexrud/d5b28eefb4211bf130bfa3e844b8e3c0 to your computer and use it in GitHub Desktop.
Save nicholasblexrud/d5b28eefb4211bf130bfa3e844b8e3c0 to your computer and use it in GitHub Desktop.
Encode file content to base64
import base64
with open("yourfile.ext", "rb") as image_file:
encoded_string = base64.b64encode(image_file.read())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment