import json | |
def load_data(filename="data.json"): | |
try: | |
with open(filename, "r") as f: | |
data = json.load(f) | |
except FileNotFoundError: | |
data = {} # Initialize an empty dictionary if no data file exists | |
return data | |
def save_data(data, filename="data.json"): | |
with open(filename, "w") as f: | |
json.dump(data, f) |