-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjsonhandling.py
53 lines (42 loc) · 1006 Bytes
/
jsonhandling.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import json
# data sets, not used yet
anna = {
"name": "Anna",
"folge": 0,
"freikarten": 0,
"youtube": 0,
"einmal_aufstehen": 0,
"massage": 0,
"sklave": 0,
"striptease": 0,
"hasssache": 0,
}
james = {
"name": "James",
"folge": 0,
"freikarten": 0,
"youtube": 0,
"einmal_aufstehen": 0,
"massage": 0,
"sklave": 0,
"striptease": 0,
"hasssache": 0,
}
# turning python into readable json
data_anna = json.dumps(anna, indent=2)
data_james = json.dumps(james, indent=2)
def addJson():
global anna, james, data_anna, data_james
# adding json for james data
with open("data_james.json", "a") as file:
file.write(data_james)
# adding json for annas data
with open("data_anna.json", "a") as file:
file.write(data_anna)
# func for reseting the data
def reset():
global anna, james, data_anna, data_james
with open("data_anna.json", "w") as file:
file.write(data_anna)
with open("data_james.json", "w") as file:
file.write(data_james)