python实现两个一维列表合并成一个二维列表

我就废话不多说了,直接上代码吧!

>>> list1 = [1,2,3,4,4]
>>> list2 = [2,3,4,5,2]
>>> z = list(zip(list1,list2))
>>> z
[(1, 2), (2, 3), (3, 4), (4, 5), (4, 2)]
>>> z[1][1]
3
>>> z[0][1]
2
>>> z[2]
(3, 4)

相关推荐