fosshelp
Custom Search
Friday, April 2, 2010
Sorting a list of objects by multiple attributes in python
Sorting a list of objects by multiple attributes in python
In Python 2.5 you can do this with operator.attrgetter():
L.sort(key=operator.attrgetter('project', 'message', 'created_on'))
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment