How to create a deep copy of a given dictionary in Python

1 Answer

0 votes
import copy

dict = {"a": 1, "bb": 2, "ccc": 3, "dddd": 4}

deepcopy_dict = copy.deepcopy(dict)

print(deepcopy_dict)


 
 
'''
run:
 
{'a': 1, 'bb': 2, 'ccc': 3, 'dddd': 4}
 
'''

 



answered Aug 30, 2021 by avibootz

Related questions

1 answer 138 views
2 answers 211 views
1 answer 251 views
1 answer 147 views
1 answer 112 views
112 views asked Aug 29, 2018 by avibootz
2 answers 168 views
168 views asked Dec 5, 2017 by avibootz
...