Python: Confused with list.remove

后端 未结 3 1139
野趣味
野趣味 2021-01-11 18:27

I\'m very new to Python, so sorry for the probably simple question. (Although, I spent now 2 hours to find an answer)

I simplified my code to illustrate the problem

3条回答
  •  星月不相逢
    2021-01-11 19:14

    eva and side refer to the same list.

    If you want to have a copy of the list:

    eva = side[:]
    

    You can read more about copying lists in this article: Python: copying a list the right way

    Edit: That isn't the only way to copy lists. See the link posted in the first comment of this answer.

提交回复
热议问题