-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave.py
35 lines (27 loc) · 817 Bytes
/
save.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
import os
import json
mainFolder=os.getcwd()
try:
os.mkdir("Sounds")
except:
pass
os.chdir(os.getenv('APPDATA'))
try:
os.mkdir("ozGames_learnEnglish")
except:
pass
else:
with open(os.getcwd()+"\ozGames_learnEnglish\save.json","w") as dosya:
dosya.write(json.dumps([0]))
def Get(index):
os.chdir(os.getenv('APPDATA')+"\ozGames_learnEnglish")
with open(os.getcwd()+"\save.json","r") as dosya:
value=json.loads(dosya.read())[index]
return value
def Set(index,value):
os.chdir(os.getenv('APPDATA')+"\ozGames_learnEnglish")
with open(os.getcwd()+"\save.json","r") as dosya:
old=json.loads(dosya.read())
old[index]=value
with open(os.getcwd()+"\save.json","w") as dosya:
dosya.write(json.dumps(old))