Tuples ? How to ?

Rikard Bosnjakovic bos at hack.org
Tue Apr 3 06:49:46 EDT 2001


Mickael ABBAS wrote:

> How to make a imbricated tuple as, for example:
> ((1,10),(2,20),(3,30))
> when we don't know the size and we have only the two lists:
> [1,2,3] and
> [10,20,30]

>>> a = (1,2,3)
>>> b = (5,6,7)
>>> zip(a,b)
[(1, 5), (2, 6), (3, 7)]
>>> map(None, a, b)
[(1, 5), (2, 6), (3, 7)]


I think zip() is Python 2.0, but I'm not sure.

-- 
Rikard Bosnjakovic - http://a214.ryd.student.liu.se/cv/ - ICQ: 1158217

Anyone sending unwanted advertising e-mail to my address will be
charged $250 for network traffic and computing time. By extracting my
address from this message or its header, you agree to these terms.



More information about the Python-list mailing list