Code:
d = {\'a\': 0, \'b\': 1, \'c\': 2} l = d.keys() print l
This prints [\'a\', \'c\', \'b\']. I\'m unsure of how the metho
[\'a\', \'c\', \'b\']
>>> print sorted(d.keys()) ['a', 'b', 'c']
Use the sorted function, which sorts the iterable passed in.
The .keys() method returns the keys in an arbitrary order.
.keys()