KEYS() returns a list of the keys of all the entries of a dictionary.

Example 1

{"First Name": "Thorben", "Last Name": "Croisé"}.keys()

This creates a simple dictionary with just two entries. We then get the list of the keys of these entries, so this results in ["First Name", "Last Name"].

Example 2

p is Person

This return all the keys of the values dictionary of a person.

Last updated