copy

a=b, a copy like this, essentially a and b refer to the same object, and when a changes, the corresponding b will also make the same change;

For container objects such as lists and dictionaries, it is divided into: shallow copy b=list(a) and deep copy b=copy.deepcopy(a)

Shallow copy changes the elements common to the objects at the same time;

deep copy when one object is operated, another object is not affected by it

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326854151&siteId=291194637