Why does modifying copy of array affect original?

后端 未结 3 1518
情书的邮戳
情书的邮戳 2020-12-18 09:21

Hi everyone I am sorry if this is a noob question but I am using python and I have an issue where I copy an array but then when I modify the copy it affects the original. I

3条回答
  •  没有蜡笔的小新
    2020-12-18 09:31

    Because your using an array of arrays (list of lists) the inner list is an object so you are only copying the reference of the inner object instead of copying the values.

提交回复
热议问题