I didn't understand it at all, so make a note
Even with shallow copy, the value of the latest element (?) Is copied.
>>> import copy
>>> a = {1:[1,2,3],2:0}
>>> b = copy.copy(a)
>>> c = copy.deepcopy(a)
>>> a
{1: [1, 2, 3], 2: 0}
>>> b
{1: [1, 2, 3], 2: 0}
>>> c
{1: [1, 2, 3], 2: 0}
>>> a[1].append(100)
>>> a[2] = 200
>>> a
{1: [1, 2, 3, 100], 2: 200}
>>> b
{1: [1, 2, 3, 100], 2: 0}
>>> c
{1: [1, 2, 3], 2: 0}
>>>
Recommended Posts