0

Currently doing the following:

import collections
dict = {'alex1':'thing1','alex2':'thing2','alex11':'thingy','adam1':'foo','adam3':'bar','adam22':'drew'}
od = collections.OrderedDict(sorted(dict.items()))
for key,val in od.items():
    print key

And getting the following

adam1
adam22
adam3
alex1
alex11
alex2

Which is sorted, but I would like it to be:

adam1
adam3
adam22
alex1
alex2
alex11

Where it is both alphabetical and numerical order. How can I achieve this?

Badmiral
  • 1,549
  • 3
  • 35
  • 74

0 Answers0