File size: 352 Bytes
5bcf2a3 |
1 2 3 4 5 6 7 8 9 10 11 12 |
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) |