.keys()

StevenSwiniarski's avatar
Published May 23, 2022
Contribute to Docs

The .keys() method of a Python dictionary returns list of its keys. It takes no arguments.

Syntax

dictionary.keys()

Codebyte Example

The following example creates a dictionary then prints all of its keys:

Code
Output
Loading...

All contributors

Contribute to Docs

Learn Python on Codecademy