Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
the easiest
a = b[:]
# или
a = b.copy()
b = [1, 2]
>>> b.append(b)
>>> b
[1, 2, [...]]
>>> id(b)
139920848119752
>>> id(b[2])
139920848119752
>>> a = b[:]
>>> a
[1, 2, [1, 2, [...]]]
>>> id(a)
139920848120456
>>> id(a[2])
139920848119752
from copy import deepcopy
>>> a = deepcopy(b)
>>> a
[1, 2, [...]]
>>> id(a)
139920847744840
>>> id(a[2])
139920847744840
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question