python dictionary print all keys and values code example
Example 1: print key of dictionary python
for key, value in mydic.items() :
print (key, value)
Example 2: how to print all elements of a dictionary in python
my_dict = {"one": 1,"two":2,"three":3,"four":4}
for item in my_dict:
print("Key : {} , Value : {}".format(item,my_dict[item]))
Example 3: get all keys and values from dictionary python
for k,v in dict.items():
print(k, v)
Example 4: print key of dictionary python
for key, value in mydic.iteritems() :
print key, value