I am having the list like below
list1=[‘abc’,‘oops’,’#exclude=10’,‘exclude=java* kln*’,‘smith’,‘johns’]
I am trying to delete the element which contains the word ‘exclude’ by using the below code.
x=0
for i in list1:
if ‘exclude’ in i:
list1.pop(x)
x+=1
print list1
When i run the programme it is removing the first exclude not the second one. Please let me know how to remove all exclude and what mistake i am doing.