Python Remove Array Item


Removing Array Elements

You can use the pop() method to remove an element from the array.

Example

Delete the second element of the cars array:

cars.pop(1)
Try it Yourself »

You can also use the remove() method to remove an element from the array.

Example

Delete the element that has the value "Volvo":

cars.remove("Volvo")
Try it Yourself »

Note: The list's remove() method only removes the first occurrence of the specified value.



Copyright 1999-2023 by Refsnes Data. All Rights Reserved.