What is the meaning of [:] in python

This question already has an answer here:

  • Understanding Python's slice notation 29 answers

  • [:] is the array slice syntax for every element in the array.

    This answer here goes more in depth of the general uses: Explain Python's slice notation

    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/26748.html

    上一篇: plt.plot [:,0]和[:,1]的含义

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