I've found myself stumped when trying to organize this list of
objects. The objects in question are timesheets which i'd like to
sort by four attributes:
class TimeSheet:
department = string
engagement = string
date = datetime.date
stare_hour = datetime.time
My ultimate goal
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
On Feb 6, 1:03 pm, bearophileh...@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,
On Feb 6, 1:03 pm, bearophileh...@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,
On Feb 6, 2:17 pm, Robocop btha...@physics.ucsd.edu wrote:
On Feb 6, 1:03 pm, bearophileh...@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.
On Feb 6, 2:20 pm, Robocop btha...@physics.ucsd.edu wrote:
On Feb 6, 2:17 pm, Robocop btha...@physics.ucsd.edu wrote:
On Feb 6, 1:03 pm, bearophileh...@lycos.com wrote:
Robocop:
then within each department block of the list, have it organized by
projects.
I don't know what
Robocop wrote:
UH OH GUYS!
line 110, in sorter
timesheets.sort(key=attrgetter(department, engagement,
date,start))
TypeError: attrgetter expected 1 arguments, got 4
Um... what version of Python are you running? Alway specify. (Too many
people do not). In 3.0
from operator import
On Feb 6, 2:34 pm, Robocop btha...@physics.ucsd.edu wrote:
On Feb 6, 2:20 pm, Robocop btha...@physics.ucsd.edu wrote:
On Feb 6, 2:17 pm, Robocop btha...@physics.ucsd.edu wrote:
On Feb 6, 1:03 pm, bearophileh...@lycos.com wrote:
Robocop:
then within each department block of the
I think there may have been a misunderstanding. I was already using
attrgetter, my problem is that it doesn't appear to be sorting by the
argument i give it. How does sort work with strings? How about with
datetime.time or datetime.date?
You were using the attrgetter, but it looks like you
On Feb 6, 2:41 pm, Stephen Hansen apt.shan...@gmail.com wrote:
I think there may have been a misunderstanding. I was already using
attrgetter, my problem is that it doesn't appear to be sorting by the
argument i give it. How does sort work with strings? How about with
datetime.time or
10 matches
Mail list logo