import copy
a = [1, 2, 3, 4, ['a', 'b']]
b = a
c = copy.copy(a)
d = copy.deepcopy(a)
a.append(5)
a[4].append('c')
结果:
a——[1, 2, 3, 4, ['a', 'b', 'c'], 5]
b——[1, 2, 3, 4, ['a', 'b', 'c'], 5]
c——[1, 2, 3, 4, ['a', 'b', 'c']]
d——[1, 2, 3, 4, ['a', 'b']]
网友评论