On 20/07/2012 04:07, larry.mart...@gmail.com wrote:
[snip]
Also, in make_dir5_key the format specifier for strftime should be %y%m
%d so they sort properly.
Correct. I realised that only some time later, after I'd turned off my
computer for the night. :-(
--
http://mail.python.org/mailman/listi
"larry.mart...@gmail.com" writes:
> It seems that if you do a list(group) you have consumed the list. This
> screwed me up for a while, and seems very counter-intuitive.
You've consumed the *group* which is an iterator, in order to construct
a list from its elements. Sorry if this is excessively
"larry.mart...@gmail.com" writes:
> It seems that if you do a list(group) you have consumed the list. This
> screwed me up for a while, and seems very counter-intuitive.
Yes, that is correct, you have to carefully watch where the stuff in the
iterators is getting consumed, including when there ar
larry.mart...@gmail.com wrote:
> It seems that if you do a list(group) you have consumed the list. This
> screwed me up for a while, and seems very counter-intuitive.
Many itertools functions work that way. It allows you to iterate over the
items even if there is more data than fits into memory.
On Jul 19, 7:01 pm, "larry.mart...@gmail.com"
wrote:
> On Jul 19, 3:32 pm, MRAB wrote:
>
>
>
>
>
>
>
>
>
> > On 19/07/2012 20:06, larry.mart...@gmail.com wrote:
>
> > > On Jul 19, 1:02 pm, "Prasad, Ramit" wrote:
> > >> > > I am making the assumption that you intend to collapse the directory
> >
On Jul 19, 1:43 pm, Paul Rubin wrote:
> "larry.mart...@gmail.com" writes:
> > Thanks for the reply Paul. I had not heard of itertools. It sounds
> > like just what I need for this. But I am having 1 issue - how do you
> > know how many items are in each group?
>
> Simplest is:
>
> for key, grou
On Jul 19, 3:32 pm, MRAB wrote:
> On 19/07/2012 20:06, larry.mart...@gmail.com wrote:
>
>
>
>
>
>
>
> > On Jul 19, 1:02 pm, "Prasad, Ramit" wrote:
> >> > > I am making the assumption that you intend to collapse the directory
> >> > > tree and store each file in the same directory, otherwise I can
On Jul 19, 1:56 pm, Paul Rubin wrote:
> "larry.mart...@gmail.com" writes:
> > You can't do a len on the iterator that is returned from groupby, and
> > I've tried to do something with imap or defaultdict, but I'm not
> > getting anywhere. I guess I can just make 2 passes through the data,
>
On 19/07/2012 20:06, larry.mart...@gmail.com wrote:
On Jul 19, 1:02 pm, "Prasad, Ramit" wrote:
> > I am making the assumption that you intend to collapse the directory
> > tree and store each file in the same directory, otherwise I can't think
> > of why you need to do this.
> Hi Simon, thanks
"larry.mart...@gmail.com" writes:
> You can't do a len on the iterator that is returned from groupby, and
> I've tried to do something with imap or defaultdict, but I'm not
> getting anywhere. I guess I can just make 2 passes through the data,
> the first time getting counts. Or am I missing
"larry.mart...@gmail.com" writes:
> Thanks for the reply Paul. I had not heard of itertools. It sounds
> like just what I need for this. But I am having 1 issue - how do you
> know how many items are in each group?
Simplest is:
for key, group in groupby(xs, lambda x:(x[-1],x[4],x[5])):
gs
On Jul 18, 4:49 pm, Paul Rubin wrote:
> "larry.mart...@gmail.com" writes:
> > I have an interesting problem I'm trying to solve. I have a solution
> > almost working, but it's super ugly, and know there has to be a
> > better, cleaner way to do it. ...
>
> > My solution involves multiple maps and
On Jul 19, 1:02 pm, "Prasad, Ramit" wrote:
> > > I am making the assumption that you intend to collapse the directory
> > > tree and store each file in the same directory, otherwise I can't think
> > > of why you need to do this.
>
> > Hi Simon, thanks for the reply. It's not quite this - what I a
> > I am making the assumption that you intend to collapse the directory
> > tree and store each file in the same directory, otherwise I can't think
> > of why you need to do this.
>
> Hi Simon, thanks for the reply. It's not quite this - what I am doing
> is creating a zip file with relative path
On Jul 18, 4:49 pm, Paul Rubin wrote:
> "larry.mart...@gmail.com" writes:
> > I have an interesting problem I'm trying to solve. I have a solution
> > almost working, but it's super ugly, and know there has to be a
> > better, cleaner way to do it. ...
>
> > My solution involves multiple maps and
On Jul 18, 6:36 pm, Simon Cropper
wrote:
> On 19/07/12 08:20, larry.mart...@gmail.com wrote:
>
>
>
>
>
>
>
>
>
> > I have an interesting problem I'm trying to solve. I have a solution
> > almost working, but it's super ugly, and know there has to be a
> > better, cleaner way to do it.
>
> > I have
On 19/07/12 08:20, larry.mart...@gmail.com wrote:
I have an interesting problem I'm trying to solve. I have a solution
almost working, but it's super ugly, and know there has to be a
better, cleaner way to do it.
I have a list of path names that have this form:
/dir0/dir1/dir2/dir3/dir4/dir5/di
"larry.mart...@gmail.com" writes:
> I have an interesting problem I'm trying to solve. I have a solution
> almost working, but it's super ugly, and know there has to be a
> better, cleaner way to do it. ...
>
> My solution involves multiple maps and multiple iterations through the
> data. How woul
I have an interesting problem I'm trying to solve. I have a solution
almost working, but it's super ugly, and know there has to be a
better, cleaner way to do it.
I have a list of path names that have this form:
/dir0/dir1/dir2/dir3/dir4/dir5/dir6/file
I need to find all the file names (basename
19 matches
Mail list logo