On 17 Jan 2007 04:50:33 -0800, Will McGugan <[EMAIL PROTECTED]> wrote:
>
> Will McGugan wrote:
>
> > Hi,
> >
> > I'd like a generator that takes a sequence and yields tuples containing
> > n items of the sqeuence, but ignoring the 'odd' items. For example
>
> Forgot to add, for my purposes I will always have a sequence with a
> multiple of n items.

something along the lines of.......

>>> [ (x,x+1,x+2) for x in xrange(0,9,3) ]
[(0, 1, 2), (3, 4, 5), (6, 7, 8)]


HTH :)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to