a question about zip...

Jan Niklas Fingerle usenet-2004 at lithe.de
Wed Mar 8 15:33:12 EST 2006


KraftDiner <bobrien18 at yahoo.com> wrote:
> [(0, 1), (2, 3), (4, 5), (6, 7)]
> 
> Which is a list of tuples.. I wanted a tuple of tuples...

>>> odd = (1,3,5,7)
>>> even = (0,2,4,6)
>>> all = zip(even, odd)
>>> all
[(0, 1), (2, 3), (4, 5), (6, 7)]
>>> tuple(all)
((0, 1), (2, 3), (4, 5), (6, 7))

Cheers,
  --Jan Niklas



More information about the Python-list mailing list