Skip to content
UPEEC

copy

Shallow and deep copies of objects.

Easy
Comments 0
import copy
b = copy.copy(a)        # new outer object, shared inner objects
c = copy.deepcopy(a)    # fully independent copy

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.