Last active
April 8, 2023 20:06
-
-
Save KD-MM2/508840b0ce9a2887e41067e10f8a9dee to your computer and use it in GitHub Desktop.
decode base64 and write to file python
This file contains 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 os | |
import base64 | |
files_size_under_1MB = { | |
"file_name_1": "file-1_encoded_base64", | |
"file_name_1": "file-2_encoded_base64" | |
} | |
for keys in files_size_under_1MB: | |
try: os.remove(keys) # remove the old file | |
except: pass | |
with open(keys, 'wb') as f: | |
f.write(base64.b64decode((files_size_under_1MB[keys]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment