.keys()

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:

Interested in helping build Docs? Read the Contribution Guide or share your feedback form.

Learn Python on Codecademy