Skip to content Skip to sidebar Skip to footer

Iterate Over Dictionary Of Objects

I have a dictionary of objects which contains the 'Names/Ranges' within a spreadsheet. As I process the spreadsheet I need to update the value associated with a range. The class t

Solution 1:

for foo in some_dict iterates through the keys of a dictionary, not its values.

d = {'a': 1, 'b': 2, 'c': 3}
forddin d:
    print(dd)
# gives a; b; c

You probably want to do for foo in some_dict.values()

forddin d.values():
    print(dd)
# gives 1; 2; 3

Post a Comment for "Iterate Over Dictionary Of Objects"