What is the meaning of [:] in python

What is the meaning of [:] in python

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

This answer here goes more in depth of the general uses: Explain Pythons 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..

What is the meaning of [:] in python

Also Read: What is the meaning of [:] in python

Leave a Reply

Your email address will not be published. Required fields are marked *