Copy Modules

copy

Provide generic shallow copying, deep copying and field replacement; assignment itself only binds references. Choose the copying operation based on which nested objects should remain shared.

Formal Syntax & Structure

python syntaxpython
copy

Return Value

module

Module object accessed through import.

Working Example

Example Snippetpython
import copya=[[1]]; b=copy.copy(a); c=copy.deepcopy(a)a[0].append(2)print(b,c)
Python Reference