keys()

The keys() method returns a list of keys from a dictionary .

@>>> spam
{'color': 'red', 'age': 42}
@>>> for k in spam.keys():
@...    print(k)
@...
color
age
  • Can pass to list() function to create list from output