Copy a dictionary
suggest changeA dictionary object has the method copy
. It performs a shallow copy of the dictionary.
>>> d1 = {1:[]}
>>> d2 = d1.copy()
>>> d1 is d2
False
>>> d1[1] is d2[1]
True
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents