Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

loop throughthe key and the values of a dict in python

a_dict = {"color": "blue", "fruit": "apple", "pet": "dog"}

# Will loop through the dict's elements (key, value) WITHOUT ORDER
for key, value in a_dict.items():
  print(key, '->', value)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #loop #throughthe #key #values #dict #python
ADD COMMENT
Topic
Name
1+3 =