What does [:] mean?

前端 未结 6 1536
时光取名叫无心
时光取名叫无心 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:02

    [:]
    used for limiter or slicing in array , hash
    eg:
    [1:5] for displaying values between 1 inclusive and 5 exclusive i.e 1-4
    [start:end]

    basically used in array for slicing , understand bracket accept variable that mean value or key to display, and " : " is used to limit or slice the entire array into packets .

提交回复
热议问题