Nahrungstracker/app/pages/file_handler.py
2024-06-23 14:02:09 +02:00

14 lines
482 B
Python

import json
def save(jsettings,jhisory):
with open("saves/settings.json", "w") as data:
data.write(json.dumps(jsettings,indent=4))
with open("saves/history.json", "w") as data:
data.write(json.dumps(jhisory,indent=4))
def load(self) -> list:
with open("saves/settings.json", "r") as data:
jsettings = json.load(data)
with open("saves/history.json", "r") as data:
jhistory = json.load(data)
return jsettings,jhistory