Say, if I have a text like
text='a!a b! c!!!'
I want an outcome like this:
text='a!a b c'
So, if the end of each words is '!', I want to get rid of it. If there are multiple '!' in the end of a word, all of them will be eliminated.
print " ".join(word.rstrip("!") for word in text.split())