get dictionary value in python
my_dict = {'a': 1, 'b': 2, 'c': 3}
# keys = list(item.keys())
# the upper commented code give the list of the keys.
keys = ['a', 'b', 'c', 'd'] # if some body give the list of the keys that wasn't match with my_dict
for key in keys:
print(my_dict.get(key, 'default value when key not exist'))
"""output:
1
2
3
default value when key not exist
"""