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 156 views
2 answers 232 views
1 answer 261 views
1 answer 153 views
1 answer 124 views
124 views asked Aug 29, 2018 by avibootz
2 answers 180 views
180 views asked Dec 5, 2017 by avibootz
...