This link has been bookmarked by 18 people . It was first bookmarked on 31 Jul 2006, by Sprant Flere Imsaho Wu hanhadren Mrawhin Skell.
-
Hossein KholghiHelpful sorting info
-
Spin Laipython 下sorting相關~
-
Robert FeltyIncludes information on sorting on different keys
-
-
>>> a = [Spam(1, 4), Spam(9, 3), Spam(4, 6)]
>>> a.sort(key=lambda obj: obj.eggs)
>>> for spam in a:
>>> print spam.eggs, str(spam)
3 12
4 5
6 10
-
-
Alberto FernandezPython lists have a built-in sort() method. There are many ways to use it to sort a list and there doesn't appear to be a single, central place in the various manuals describing them, so I'll do so here.
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.