-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathjson_loads.py
More file actions
39 lines (31 loc) · 999 Bytes
/
json_loads.py
File metadata and controls
39 lines (31 loc) · 999 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
35
36
37
38
import json
data = {"polisiye": ["Sherlock", "Behzat Ç."],
"fantastik": ["Silmarillion",
"Cüce Derinlikleri Ejderhaları",
"İkizlerin Savaşı",
"İkizlerin Sınavı",
"Otostopçunun ...",
"Harry Potter"],
"klasikler": ["Beyaz Zambaklar Ülkesi",
"Sefiller",
"Yeraltından Notlar"]}
try:
with open("kitaplar.txt", "w") as dosya:
json.dump(data, dosya)
except Exception(IOError) as hata:
print(hata)
try:
with open("kitaplar.txt") as dosya:
data = json.load(dosya)
print(data)
print(type(data))
print(data.values())
except Exception(IOError) as hata:
print(hata)
# temp_liste = ["1","2","3","4","5"]
# try:
# with open("yeni_kitaplar.txt", "w") as dosya:
# for i in temp_liste:
# dosya.write(i)
# except IOError as hata:
# print(hata)