.keys()

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

Looking to contribute?

Learn Python on Codecademy