1#print keys and values from the dictionary
2
3for k, v in dic.items():
4 print(k, v)
1# using dict.items() to
2# get key and value
3print ("Dict key-value are : ")
4for key, value in test_dict.items():
5 print (key, value)
6
1# Get a value from a dictionary in python from a key
2
3# Create dictionary
4dictionary = {1:"Bob", 2:"Alice", 3:"Jack"}
5
6# Retrieve value from key 2
7entry = dictionary[2]
8
9# >>> entry
10# Alice