get keys and values from dictionary python code example
Example 1: printing python dictionary values
#print keys and values from the dictionary
for k, v in dic.items():
print(k, v)
Example 2: how to get key of a particular value in dictionary python using index
mydict = {'george': 16, 'amber': 19}
print(list(mydict.keys())[list(mydict.values()).index(16)]) # Prints george
Example 3: get all keys and values from dictionary python
#python 3
for k,v in dict.items():
print(k, v)