Last active
January 30, 2016 01:32
-
-
Save RafaAguilar/d93630c399d8902104d6 to your computer and use it in GitHub Desktop.
Order an OrderedDict with numeric String keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def str_num_order_odict(odict): | |
return OrderedDict(sorted(odict.items(), key=lambda x: int(x[0]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment