Last active
October 7, 2017 16:21
-
-
Save binary10/c6641131af9cf00ae267dc21a58db213 to your computer and use it in GitHub Desktop.
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 | |
# Create a string and encode to bytes | |
s = 'Convert me to base64!' | |
sb = s.encode('utf-8') | |
# Take bytes and encode to base64 string | |
sb64 = base64.b64encode(sb).decode() | |
# Q29udmVydCBtZSB0byBiYXNlNjQh | |
# Take base64 string and decode back to original string | |
base64.b64decode(sb64).decode('utf-8') | |
# 'Convert me to base64!' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment