I am a very new Python
I want to change the sentence if there are duplicate words.
Right
- Ex. "it's just so good" → "it's just so nice"
- Ex. "it just is" → "it just is"
Now I am using this reg. but it all changes to letters. Ex. "My friend and I am happy" → "My friend and I am happy" (he deletes the "i" and the space) ERROR
text = re.sub(r'(\w+)\1', r'\1', text)
How can I make the same change, but instead of letters it should check the words?
source share