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)
 
PREVIOUS NEXT
Tagged: #loop #throughthe #key #values #dict #python
ADD COMMENT
Topic
Name
8+1 =