CS4820-Winter2020 student project to create a COUNTER SUSHI R5 harvester and related functionality app for Windows and Mac
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
550 B

import os
def save_json_file(file_dir: str, file_name: str, json_string: str):
try:
if not os.path.isdir(file_dir):
os.makedirs(file_dir)
file = open(file_dir + file_name, 'w')
file.write(json_string)
file.close()
except IOError as e:
print(e)
def read_json_file(file_path: str):
json_string = "[]"
try:
file = open(file_path, 'r')
json_string = file.read()
file.close()
except IOError as e:
print(e)
finally:
return json_string