ใน Python 2.x ทั้งสองเมธอดพร้อมใช้งาน แต่ใน Python 3.x iteritems() ถูก Deprecated
ถึงเกี่ยวกับ Python 2.x เมธอด items() ของ Dictionary Object คืนค่า List ของ Two-element Tuples แต่ละ Tuple มี Key และ Value ส่วน iteritems() เป็น Generator ที่ให้ Iterator สำหรับ Items ใน Dictionary
>> d = {'1': 1, '2': 2, '3': 3}
>>> d.items()
[('1', 1), ('2', 2), ('3', 3)]
>>> for i in d.iteritems():
... print i
('1', 1)
('2', 2)
('3', 3)
ใน Python 3 เมธอด items() พฤติกรรมเหมือน iteritems() ใน Python 2
>> d = {'1': 1, '2': 2, '3': 3}
>>> d.items()
dict_items([('1', 1), ('2', 2), ('3', 3)])
>>> for i in d.items():
... print(i)
('1', 1)
('2', 2)
('3', 3)