copy

a=b, a copy like this, essentially a and b refer to the same object, and when a changes, the corresponding b will 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://43.154.161.224:23101/article/api/json?id=324729831&siteId=291194637