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


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.


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

print my_dict just prints the dictionary


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