Reverse zip() ?
geekmail at usenot.de
Tue Dec 2 21:44:02 CET 2008
On Tue, 02 Dec 2008 21:12:19 +0100 Stefan Behnel <stefan_ml at behnel.de>
> Andreas Waldenburger wrote:
> > [snip]
> > This is of course trivial to do via iteration or listcomps, BUT, I
> > was wondering if there is a function I don't know about that does
> > this nicely?
> I think you're asking about zip():
> >>> l=[1,2,3]
> >>> zip(l,l)
> [(1, 1), (2, 2), (3, 3)]
> >>> zip(*zip(l,l))
> [(1, 2, 3), (1, 2, 3)]
So I am. That sure was weird.
Thanks for the quick and somewhat surreal help. Need I say that between
posting this question and reading your reply I set out to implement
My real email address is constructed by swapping the domain with the
recipient (local part).
More information about the Python-list