.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:

us
Visit us
code
Hide code
Code
Output
Hide output
Hide output
Loading...

All contributors

Looking to contribute?

Learn Python on Codecademy