a question about zip...

Jeff Elmore jelmore at lexile.com
Wed Mar 8 15:28:05 EST 2006


Just do:

tuple(zip(even,odd))

-----Original Message-----
From: python-list-bounces+jelmore=lexile.com at python.org
[mailto:python-list-bounces+jelmore=lexile.com at python.org] On Behalf Of
KraftDiner
Sent: Wednesday, March 08, 2006 3:22 PM
To: python-list at python.org
Subject: a question about zip...

I had a structure that looked like this
((0,1), (2, 3), (4, 5), (6,7)

I changed my code slightly and now I do this:
odd = (1,3,5,7)
even = (0,2,4,6)
all = zip(even, odd)

however the zip produces:
[(0, 1), (2, 3), (4, 5), (6, 7)]

Which is a list of tuples.. I wanted a tuple of tuples...

-- 
http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list