1.示例一:
>>> a = [1,2,3]
>>> b = [2,3,4]
>>> ab = zip(a,b)
>>> print ab
[(1, 2), (2, 3), (3, 4)]
>>> type(a)
<type 'list'>
>>> type(ab)
<type 'list'>
2.示例二:
>>> a = [1,2,3]
>>> b = [2,3,4]
>>> c = [3,4,5]
>>> abc = zip(a,b,c)
>>> print abc
[(1, 2, 3), (2, 3, 4), (3, 4, 5)]
>>> type(a)
<type 'list'>
>>> type(abc)
<type 'list'>
>>> abc = zip(*abc)
>>> print abc
[(1, 2, 3), (2, 3, 4), (3, 4, 5)]
3.示例三:
>>> x = (1,2,3)
>>> y = (2,3,4)
>>> xy = zip(x,y)
>>> print xy
[(1, 2), (2, 3), (3, 4)]
>>> type(x)
<type 'tuple'>
>>> type(xy)
<type 'list'>