So very much like in this question except that I would like to replace any part of words
that matches with anything in error_list
with ''
.
error_list = ['[br]', '[ex]', 'Something']
words = ['how', 'much[ex]', 'is[br]', 'the', 'fish[br]', 'noSomething', 'really']
The desired output would be
words = ['how', 'much', 'is', 'the', 'fish', 'no', 'really']
My vain attempt was,
words = [w.replace(error_list , '') for w in word]
EDIT: Maybe I should also say that I have done this with loops but was looking for a more pythonic way.