标签:for keyword ams class bsp param key title ber
>>> a = [1,2,3,4,5]
>>> b = [9,8,7,6,5]
>>> length = len(a) if len(a)<len(b) else len(b)
>>> length
5
>>> c = zip(a,b)
>>> c
[(1, 9), (2, 8), (3, 7), (4, 6), (5, 5)]
>>>zip(*c)
[(1,2,3,4,5), (9,8,7,6,5)]
>>> d = []
>>> for x,y in zip(a,b):
d.append(x+y)
>>> d
[10, 10, 10, 10, 10]
标签:for keyword ams class bsp param key title ber
原文地址:http://www.cnblogs.com/zftylj/p/python0001.html