"multi" zip

Bengt Richter bokr at oz.net
Thu Jun 27 13:04:26 EDT 2002


On Thu, 27 Jun 2002 16:05:01 GMT, "Emile van Sebille" <emile at fenx.com> wrote:

>Mark
>> 1) instead of producing tuples, I'd like to produce lists.
>>
>> 2) I'd like to extend this to an arbitrary number of lists.  If it
>were
>> possible, I'd do zip(line[0], line[1], ..., line[n]) but this doesn't
>seem
>> to compile :).
>>
>> Is there a way to make zip() do this, or should I stop trying to
>hammer with
>> a wrench?
>>
>
>
>>>> line = [range(ii*10,11*10+5) for ii in range(5) ]
                         ^^-- assuming you meant ii
>>>> map (list,zip(*line))
>
Nice.

Regards,
Bengt Richter



More information about the Python-list mailing list