What is the meaning of [:] in python
This question already has an answer here:
[:]
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
下一篇: python中[:]的含义是什么?