Answers for "python remove string from list"

4

pytho. how to remove from a list

names = ['Boris', 'Steve', 'Phil', 'Archie']
names.pop(0) #removes Boris
names.remove('Steve') #removes Steve
Posted by: Guest on October-19-2020
5

python remove by index

a = [0, 1, 2, 3, 4, 5]
el = a.pop(2)
Posted by: Guest on March-05-2020
-1

pop a string from a list python

my_list = [12, 'Siya', 'Tiya', 14, 'Riya', 12, 'Riya']
my_list.remove(12) # it will remove the element 12 at the start.
print(my_list)
my_list.remove('Riya') # will remove the first Riya from the list
print(my_list)
my_list.remove(100)  #will throw an error
print(my_list)
Posted by: Guest on May-26-2021

Code answers related to "python remove string from list"

Python Answers by Framework

Browse Popular Code Answers by Language