-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTask10.py
47 lines (38 loc) · 1.09 KB
/
Task10.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
import json
from pprint import pprint
file = open('details2.json', 'r')
data = json.load(file)
Directors = []
Details = {}
Directors_without_list = []
for i in data :
if i['Director'] not in Directors :
a = i['Director']
Directors.append(i['Director'])
for j in a :
Directors_without_list.append(j)
for i in Directors_without_list :
Details[i] = {}
Language = []
for i in data :
for j in i :
a = (i['Languages'])
for x in a :
if x not in Language :
Language.append(x)
for i in Directors_without_list :
for r in Language :
c = 0
for x in data :
for j in x['Director'] :
if j == i :
for t in x['Languages'] :
if t == r :
c+=1
if c>0 :
for n in Details :
if n == i :
Details[n][r] = c
file = open('data_of_task10.json','w')
data = json.dump(Details , file , indent = 4)
print(Details)