.copy()

Published May 23, 2022
Contribute to Docs

The .copy() method of a Python dictionary returns a copy of the dictionary. It takes no arguments.

Syntax

dictionary.copy()

Codebyte Example

The following example creates a dictionary, creates a copy of the dictionary, then adds new elements to the copy.

us
Visit us
code
Hide code
Code
Output
Hide output
Hide output
Loading...

All contributors

Looking to contribute?

Learn Python on Codecademy