Answers for "fetch data from dictionary python in for loop"

2

how to iterate over dictionary in python

>>> for key, value in a_dict.items():
...     print(key, '->', value)
...
color -> blue
fruit -> apple
pet -> dog
Posted by: Guest on October-28-2020
0

fetch data from dictionary python in for loop

>>> # Python 2.7
>>> a_dict = {'color': 'blue', 'fruit': 'apple', 'pet': 'dog'}
>>> a_dict
{'color': 'blue', 'pet': 'dog', 'fruit': 'apple'}
>>> a_dict
{'color': 'blue', 'pet': 'dog', 'fruit': 'apple'}
Posted by: Guest on January-19-2021

Code answers related to "fetch data from dictionary python in for loop"

Python Answers by Framework

Browse Popular Code Answers by Language