-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.py
More file actions
34 lines (27 loc) · 831 Bytes
/
data.py
File metadata and controls
34 lines (27 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
import json
class Data:
with open("data/data.json", "ab+") as ab:
ab.close()
f = open('data/data.json','r+')
f.readline()
if os.stat("data/data.json").st_size == 0:
f.write('{"money" : 0, "chickens" : 0, "eggs" : 0, "moneyMultiplier": 1, "eggLayingRate": 1}')
f.close()
else:
pass
def __init__(self):
pass
def getData():
with open("data/data.json", 'r') as f:
data = json.load(f)
f.close()
return data
def save(DATA):
with open('data/data.json', 'w') as f:
json.dump(DATA, f)
f.close()
def manualSave(DATA):
with open('data/data.json', 'w') as f:
json.dump(DATA, f)
f.close()