Dictionary: create a new list of keys : Dictionary Key « Dictionary « Python






Dictionary: create a new list of keys

Dictionary: create a new list of keys
 
d2 = {'spam': 2, 'ham': 1, 'eggs': 3}    # make a dictionary

print d2                                       # order is scrambled

print d2.keys()                  # create a new list of my keys


           
         
  








Related examples in the same category

1.Use variable as a keyUse variable as a key
2.For loop through the dictionary keysFor loop through the dictionary keys
3.Dictionary: The keys, values, and items FunctionsDictionary: The keys, values, and items Functions
4.Sorting Keys: for Loops
5.Dictionary Keys Are Case-SensitiveDictionary Keys Are Case-Sensitive