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())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With