What does [:] mean?

前端 未结 6 1539
时光取名叫无心
时光取名叫无心 2020-11-27 02:33

I\'m analyzing some Python code and I don\'t know what

pop = population[:]

means. Is it something like array lists in Java or like a bi-di

6条回答
  •  遥遥无期
    2020-11-27 03:25

    It creates a copy of the list, versus just assigning a new name for the already existing list.

提交回复
热议问题