How to copy a dictionary and only edit the copy

前端 未结 20 2397
说谎
说谎 2020-11-21 06:59

Can someone please explain this to me? This doesn\'t make any sense to me.

I copy a dictionary into another and edit the second and both are changed. Why is this hap

20条回答
  •  孤城傲影
    2020-11-21 07:37

    dict2 = dict1 does not copy the dictionary. It simply gives you the programmer a second way (dict2) to refer to the same dictionary.

提交回复
热议问题