0
How to remove
List=['i', 'b', 'i', 'a', 'i'] I want to remove all the 'i' in the list completely How to do
6 Respostas
+ 3
li= list(filter(lambda x: x!= 'i',List))
+ 2
li = [l for l in List if l!='i']
Or, if you want to keep the list:
for i in range(len(List)):
if List[i]=='i':
del List[i]
0
list=['i', 'b', 'i', 'a', 'i']
a = list.count('i')
for i in range(a):
list.remove('i')
I hope it helps!!!!
0
li = list('ibiai')
for i in li:
if i=='i':
li.remove(i)
print(li)
0
# use the lambda function
List = list(filter(lambda x: x!= 'i' , List))
0
list=["i","b","i","a","i"]
s=[]
for c in list:
if c!="i":
s.append(c)
print(s)