Created
March 16, 2022 08:24
-
-
Save pixdoet/8f84fa76592462f3345b5c3944198886 to your computer and use it in GitHub Desktop.
Python script to convert any file to a base64 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
import base64 | |
filename = input("Enter file location: ") | |
with open(filename, "rb") as f: | |
data = f.read() | |
base64_1 = base64.encodestring(data) | |
with open("output.txt", "w") as w: | |
w.write(base64_1.decode("ascii")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment