You can remove the first item with the specified value in a list in Python by following the given step. If you want to learn Python then I will highly recommend you to read This Book.
Step 1
Remove method is used to remove the first item with the specified value in a list in Python. In the following example, I will remove integer ‘4’ from the list that will come first in a list.
a = [1,2,3,1,7,4,8,9,4,21] print(a) a.remove(4) print(a)
Example: In case of String
a = ['x','y','c','z','a','b','c'] print(a) a.remove('c') print(a)
People are also reading:
What is Computer Vision? Examples, Applications, Techniques