ogward ogward - 1 year ago 74
Python Question

two lists into one multidimensional list

I would like to merge two lists into one 2d list.

list1=["Peter", "Mark", "John"]
list2=[1,2,3]


into

list3=[["Peter",1],["Mark",2],["John",3]]

Answer Source
list3 = [list(a) for a in zip(list1, list2)]