Answers for "look up using dict python for loops key"

122

python iterate dictionary key value

a_dict = {'color': 'blue', 'fruit': 'apple', 'pet': 'dog'}
for key, value in a_dict.items():
  print(key, '->', value)
Posted by: Guest on December-13-2019
1

look through dict

for key, value in d.items():
	...

for key in d.keys():
	...

for value in d.values():
	...
Posted by: Guest on July-25-2021

Python Answers by Framework

Browse Popular Code Answers by Language