forked from UCL-RITS/friend-group-2020
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroup.py
44 lines (39 loc) · 822 Bytes
/
group.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
import json
group = {
"Jill": {
"age": 26,
"job": "biologist",
"relations": {
"Zalika": "friend",
"John": "partner"
}
},
"Zalika": {
"age": 28,
"job": "artist",
"relations": {
"Jill": "friend"
}
},
"John": {
"age": 27,
"job": "writer",
"relations": {
"Jill": "partner"
}
},
"Nash": {
"age": 34,
"job": "chef",
"relations": {
"John": "cousin",
"Zalika": "landlord"
}
}
}
# write file
with open('group_friends.json', 'w') as json_file:
json.dump(group, json_file, indent=4)
with open('group_friends.json', 'r') as json_file:
group_friends = json_file.read()
print(group_friends)