2
I have the following situation:
I have the list 1 with the following values [10,20,30,40]. I want to create a copy of this list, but I need the list_2 not to change when I modify some value of the list_1.
I have the following code below, but you are not doing what I need.
lista_1 = [10,20,30,40]
lista_2 = lista_1[:]
print (lista_2)
Thanks in advance.
Thanks for the reply friend. But, that’s not what I need, because when I change the list_1 to list_2 also modifies. I need, that when modifying the list_1 to list_2 does not change. That is, unlinked lists.
– Danilo
I edited, @Danilo
– Miguel
Perfect Miguel. That’s what I needed. Thank you very much.
– Danilo
You’re welcome @Danilo
– Miguel