ogward ogward - 9 days ago 5
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
list3 = [list(a) for a in zip(list1, list2)]