Sorting a List of Objects by an Attribute of the Objects Case-Insensitively
elgrandchignon at gmail.com
Wed Apr 9 05:04:48 CEST 2008
Basically, I have a pressing need for a combination of 5.2 "Sorting a
List of Strings Case-Insensitively" & 5.3 "Sorting a List of Objects
by an Attribute of the Objects" from the Python Cookbook.
My first guess isn't working:
def sort_by_attr(seq, attr):
return sorted(seq, key)
...would much appreciate any guidance!
More information about the Python-list