Mukera / data.py
Seraph19's picture
Create data.py
5bcf2a3 verified
raw
history blame contribute delete
No virus
352 Bytes
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)