Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

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?

1 Answer

0 votes
by (106k points)

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.

Related questions

+5 votes
2 answers
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...