.items()

StevenSwiniarski's avatar
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

Contribute to Docs

Learn Python on Codecademy