How python sorts dictionaries
This article mainly shows you "python how to sort dictionaries", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "python how to sort dictionaries" this article.
Sort dictionary (collections.OrderedDict)
> m = dict ((str (x), x) for x in range (10)) > > print "," .join (m.keys ()) 1,0,3,2,5,4,7,6,9,8 > > m = collections.OrderedDict ((str (x), x) for x in range (10)) > > print "," .join (m.keys ()) 0,1,2,3,4,5,6,7,8,9 > m = collections.OrderedDict (str (x), x) for x in range (10) 0,-1) > print "," .join (m.keys ()) 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 are all the contents of the article "how python sorts dictionaries" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!