.items()

Published May 23, 2022
Contribute to Docs

The .items() method of a Python dictionary returns a list of tuples for each key-value pair in a dictionary. It takes no arguments.

Syntax

dictionary.items()

Codebyte Example

The following example creates a dictionary, then prints the dictionary and the output from .items():

Code
Output
Loading...

All contributors

Looking to contribute?

Learn Python on Codecademy