0

If I write the following code:

a = []
b = a
b.append(2)

Then a = [2]. Is there a way I can break the reference between b and a, so that even if I modify b, a will not be modified?

1 Answers1

0

You can, if you copy its content with

b=a[:]
TobiasR.
  • 826
  • 9
  • 19