PyDocs

Nav

Python Runtime Services

dict.popitem

builtins

method of dict
  • dict.popitem()
Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order.
Raises KeyError if the dict is empty.
Changed in 3.7
  • 3.7: LIFO order is now guaranteed. In prior versions, popitem() would return an arbitrary key/value pair.
0 Examples
No examples for builtins/dict.popitem.
See Also
No see-alsos for builtins/dict.popitem
0 Notes
No notes for dict.popitem