Created
January 5, 2021 18:19
-
-
Save yuyosy/047c54b01299b25182a13e0c2c3d936a to your computer and use it in GitHub Desktop.
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 base64 | |
import os | |
import sys | |
def file_to_basestr(file_path): | |
with open(file_path, "rb") as f: | |
return base64.b85encode(f.read()) | |
if __name__ == "__main__": | |
args = sys.argv | |
path = input('Path> ') if len(args) == 1 else args[1] | |
s = file_to_basestr(path) | |
with open(os.path.join(os.path.dirname(path), 'data.txt'), mode='wb') as f: | |
f.write(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment