Get list of keys : keys « Dictionary « Python Tutorial






year = {1:'January', 2:'February', 3:'March',
        4:'April',5:'May', 6:'June', 7:'July', 8:'August',
        9:'September', 10:'October', 11:'November',12:'December'}


months = year.keys()








8.17.keys
8.17.1.keys() returns a list of the dictionary's keys,
8.17.2.Retrieving dictionary key list
8.17.3.Retrieving dictionary value list
8.17.4.Get list of keys
8.17.5.Create subset of keys
8.17.6.Create new dictionary from subset of keys