Nahrungstracker/file_handler.py

17 lines
484 B
Python
Raw Permalink Normal View History

2024-06-17 17:13:32 +02:00
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