initial commit of project

This commit is contained in:
2021-04-11 19:51:12 +02:00
commit a21a8186d9
110 changed files with 16326178 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import os
import sys
def write_text(input_text, file_path, option="Exit"):
""" Write text to disk checking options if it exists """
if not os.path.exists(file_path):
with open(file_path, 'w') as f:
f.write(input_text.decode("utf-8"))
else:
if option == "Exit":
print("Write file error: This file already exists.\n %s \nExiting..." %(file_path))
sys.exit(1)
elif option == "Append":
with open(file_path, 'a') as f:
f.write(input_text)
elif option == "Overwrite":
with open(file_path, 'w') as f:
f.write(input_text)