-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbeebox.py
56 lines (42 loc) · 1.59 KB
/
beebox.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
53
54
55
56
#Class files
import json
class Beebox:
def __init__(self,no,cita,durum,ilac):
#Parameters
self.no = no
self.cita = cita
self.durum = durum
self.ilac = ilac
#Loading File -- will give error if .json is empty also retriewing data there is to use it like a database kinda idk
f = open("arilar.json","r+",encoding="utf-8")
data = json.load(f)
#The structure of the data json and sending it as a list to hold multiple items
data.append(
{"No" : self.no,
"Cita" : self.cita,
"Durum" : self.durum,
"Ilac" : self.ilac }
)
with open("arilar.json","w",encoding="utf-8") as arilarjson:
json.dump(data,arilarjson)
f.close
print("\nİşlem başarılı..\n")
#file is opened and closed in init
def first_time(no,cita,durum,ilac,uwu):
#If you get error from init you gotta use this func
if uwu:
x = input("Bu ilk kullanım içindir ve bilgilerinizi siler. İlk kullanımda oluşan bir hatadan dolayı\n bu method bulunmaktadır. \nDevam etmek için Y harfini girin: ")
else:
x = "Y"
if x=="Y":
data = [
{"No" : no,
"Cita" : cita,
"Durum" : durum,
"Ilac" : ilac }
]
with open("arilar.json","w",encoding="utf-8") as arilarjson:
json.dump(data,arilarjson)
arilarjson.close
else:
pass