I was trying to find a solution to a question when I came across this problem. I was trying to insert a list into the same list using insert. But I'm getting a ...
where the new list should be.
Inserting same list
layer1 = [1,2,3,4]
layer1.insert(len(layer1)//2,layer1)
Weirdly, I was getting the output
[1, 2, [...], 3, 4]
Inserting unique list
Now say I insert a unique list into layer1
.
layer1 = [1,2,3,4]
layer2 = [1,2]
layer1.insert(len(layer1)//2,layer2)
print(layer1)
My output is as expected without ...
[1, 2, [1, 2, 3], 3, 4]
Desired output
How could I get this output using insert
[1, 2, [1, 2, 3, 4], 3, 4]