Dict Methods
dict.copy()
Builds a separate dictionary with the original keys and value references in their existing insertion order. Subsequent changes to either mapping’s entries are independent, but nested objects remain shared. This is not a recursive clone. For exact dictionaries, dict(mapping) is another shallow-copy form. Subclasses may have additional state; do not assume copy preserves subclass behavior.
Formal Syntax & Structure
python syntaxpython
mapping.copy()Return Value
dict
New shallow dictionary.
Working Example
Example Snippetpython
original = {"tags": ["new"], "count": 2}clone = original.copy()clone["count"] = 3clone["tags"].append("review")print(original)print(clone)print(original is clone)