"multi" zip
Mark
Aristotle_00 at yahoo.com
Thu Jun 27 11:46:25 EDT 2002
So,
Let line be a list of lists where the sublists are the same length.
For example:
line = [ [0,1,2], [3,4,5], [6,7,8] ]
Now, I can do:
zip(line[0], line[1], line[2])
to "invert" the array. Now, I'd like to do two different things:
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?
Regards,
Mark
More information about the Python-list
mailing list