Trouble sorting a list of objects by attributes

Robocop bthayre at physics.ucsd.edu
Fri Feb 6 17:08:30 EST 2009


On Feb 6, 1:03 pm, bearophileH... at lycos.com wrote:
> 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

Projects was meant to be engagements.  All these suggestions are
great, let me see what i can make happen right now. Thanks all!



More information about the Python-list mailing list