I have a list made out of several lists (e.g. lst = [[1, 2, 3], [1, 2, 3], [1, 2, 3]]
), and I created this list appending another list to it with a for
loop:
for i in range(0, 3):
lst.append([1, 2, 3])
Then I tried to modify one of those lists (lst[0].remove(1)
).
But when I do that, all of the lists get modified, and the list looks like that: [[2, 3], [2, 3], [2, 3]]
Is there any way I can modify the list so it looks like [[2, 3], [1, 2, 3], [1, 2, 3]]
?
I also tried to use the del
function, but I didn't seem to work.