Created
December 8, 2012 00:59
-
-
Save yuchant/4237903 to your computer and use it in GitHub Desktop.
Convert file to base64. Using for fonts > b64 string.
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
| """ | |
| python to_base64.py some_file | |
| """ | |
| import sys | |
| import os | |
| def main(path): | |
| with open(path) as f: | |
| sys.stdout.write(f.read().encode('base64').replace('\n', '')) | |
| if __name__ == "__main__": | |
| main(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment