zip(a,b)的作用:将俩个输入,对应位置组合在一起,得到一个输出
转换为元组:
a = [1,2,3] b= [5,6,7] print(tuple(zip(a,b)))
((1, 5), (2, 6), (3, 7))
转换为列表:
a = [1,2,3] b= [5,6,7] print(list(zip(a,b)))
[(1, 5), (2, 6), (3, 7)]