in Python by
How to remove values from a Python array?

1 Answer

0 votes
by
The elements can be removed from a Python array using remove() or pop() function. The difference between pop() and remove() will be explained in the below example.

Example:

1

2

3

4

5

x = arr.array('d',  [ 1.0, 2.2, 3.4, 4.8, 5.2, 6.6, 7.3])

print(x.pop())

print(x.pop(3))

x.remove(1.0)

print(a)

Output:

1

2

3

7.3

4.8

array(‘d’, [2.2, 3.4, 5.2, 6.6])

 For More Info: Python Array Examples
...