1#print keys and values from the dictionary
2
3for k, v in dic.items():
4 print(k, v)
1dictionary={
2
3 "Jeff":{
4 "lastname":"bobson",
5 "age":55,
6 "working":True
7 },
8
9 "James":{
10 "lastname":"Bobson",
11 "age":34,
12 "working":False
13 }
14}
15
16# For a good format:
17
18for i in dictionary:
19 print(i, ":")
20 for j in dictionary[i]:
21 print(" ", j, ":", dictionary[i][j])
22 print()
23
24
25# Output:
26
27Jeff :
28 lastname : bobson
29 age : 55
30 working : True
31
32James :
33 lastname : Bobson
34 age : 34
35 working : False
36
37# For just a quick reading:
38
39for k, v in dictionary.items():
40 print(k, v)
41
42# Output:
43
44Jeff {'lastname': 'bobson', 'age': 55, 'working': True}
45James {'lastname': 'Bobson', 'age': 34, 'working': False}
46