Sai Rajesh Sai Rajesh - 2 months ago 5
Python Question

how to insert list into list using python?

I have lists like..

l1=[1,2,3]
l2=[7,3,4]


i need output like

l3=[[1,2,3],[7,3,4]]

Answer

You can simply do something like this:

>>> l1=[1,2,3]
>>> l2=[7,3,4]
>>> [l1, l2]
[[1, 2, 3], [7, 3, 4]]
Comments