simple iterator question

KDr2 kdr2 at x-macro.com
Thu Apr 2 09:11:54 EDT 2009


>>> def xl(a):
...     return list(reduce(lambda x,y:x+y,zip(*a)))
...
>>> xl([[1,2],[3,4]])
[1, 3, 2, 4]

like this?

Best Regards,
   -- KDr2, at x-macro.com.


On Thu, Apr 2, 2009 at 8:32 PM, Neal Becker <ndbecker2 at gmail.com> wrote:

> How do I interleave 2 sequences into a single sequence?
>
> How do I interleave N sequences into a single sequence?
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090402/84ceafb3/attachment.html>


More information about the Python-list mailing list