Trouble sorting a list of objects by attributes

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Fri Feb 6 16:03:32 EST 2009


Robocop:

>then within each department block of the list, have it organized by projects.<

I don't know what does it means.

> timesheets.sort(key=operator.attrgetter('string'))

Try something like:
timesheets.sort(key=attrgetter("department", "engagement", "date",
"stare_hour"))


> My brain might explode if i continue.

Relax.

Bye,
bearophile



More information about the Python-list mailing list