python中[:]的含义是什么?

这个问题在这里已经有了答案:

  • 了解Python的切片符号29个答案

  • [:]是数组中每个元素的数组切片语法。

    这里的答案更深入一般用途:解释Python的切片符号

    del arr # Deletes the array itself
    del arr[:]  # Deletes all the elements in the array
    del arr[2]  # Deletes the second element in the array
    del arr[1:]  # etc..
    
    链接地址: http://www.djcxy.com/p/26747.html

    上一篇: What is the meaning of [:] in python

    下一篇: slice operator understanding