Iterators for Dictionaries - Difference between printing with or without .items()


#1



Iterators for Dictionaries


I was wondering what the difference is between 'print my_dict' and 'print my_dict.items()'? So what exactly does .items() do that the print function alone doesn't?


Replace this line with your code.


#2

.items() prints a list, each key value pair is a tuple inside the list

print my_dict just prints the dictionary


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.