python - Iterating over dictionaries using 'for' loops - Stack Overflow
https://stackoverflow.com/questions/3294889/iterating-over-dictionaries-using-for-loops
WEBJul 21, 2010 · For Iterating through dictionaries, The below code can be used. dictionary= {1: "a", 2: "b", 3: "c"} #To iterate over the keys for key in dictionary.keys(): print(key) #To Iterate over the values for value in dictionary.values(): print(value) #To Iterate both the keys and values for key, value in dictionary.items(): print(key, '\t', value)
DA: 8 PA: 31 MOZ Rank: 52 Up or Down: Up