Let's say I have a string like
test = "hello Everyone! My name is Dan."
I want to make a function that removes all the words containing a specific letter like !
Then my string would be
"hello My name is Dan."
I tried this by test.split(' '), and replace it with '' if it contains the specific letter. However, since I have quite long documents, it seems to be a little inefficient.
Is there any other simple and compact way of solving this?
Thanks in advance! =]