Back
Is it legitimate to use items() instead of iteritems() in all places? Why was iteritems() removed from Python 3? Seems like a terrific and useful method. What's the reasoning behind it?
To understand where to use the iteritems() you can simply use the below-mentioned example:
common_keys = list(dict_a.viewkeys() & dict_b.viewkeys())
This will give you a list of the common keys, but again, in Python 3.x - just use .keys() instead.
31k questions
32.8k answers
501 comments
693 users