Python Remove Specific Word

Do you like this?

Summary:
This shows how to remove specific words from a string.


Content:

import re
re.sub(r'word', '', 'word wordword wordabc')
re.sub(r'word ', '', 'word wordword wordabc')
Resulst:
'  abc'
'wordwordabc'

 
comments powered by Disqus