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 happening? (为什么会这样呢?)
>>> dict1 = {"key1": "value1", "key2": "value2"}
>>> dict2 = dict1
>>> dict2
{'key2': 'value2', 'key1': 'value1'}
>>> dict2["key2"] = "WHY?!"
>>> dict1
{'key2': 'WHY?!', 'key1': 'value1'}
ask by MadSc13ntist translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…