A Faster Way...

stasz foo at bar.org
Wed May 11 05:20:40 EDT 2005


On Tue, 10 May 2005 18:11:27 -0700, gene.tani wrote:

> hmm, there's lots of ways, huh?  you can use itertools.zip instead of
> builtin zip, or do:
> 
>  map(None, list1, list2)
Not!
One should try a possible solution first,
>>> l1 = range(10)
>>> l2 = range(10,20)
>>> l1
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> l2
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
>>> map(None,l1,l2)
[(0, 10), (1, 11), (2, 12), (3, 13), (4, 14), (5, 15), (6, 16), (7, 17), (8, 18), (9, 19)]
>>> 

Stas




More information about the Python-list mailing list