sorted_event_types={}
for key,value in sorted(event_types.items()):
sorted_event_types[key]=value
(Pdb) print sorted_event_types
{'ch': 1, 'eh': 2, 'oh': 3, 'ah': 0, 'as': 1, 'cs': 0, 'os': 5, 'es': 9}
(Pdb) event_types
{'as': 1, 'ch': 1, 'eh': 2, 'oh': 3, 'cs': 0, 'ah': 0, 'os': 5, 'es': 9}
I want to sort a dictionary and keep it that way.
The output should be {'ah': 1, 'as': 1, 'ch': 2, 'cs': 3, 'eh': 0, ...}