0

I am trying to remove the spaces between sentence ending word and dot.

text = 'some sentence     .'

What I have tried so far:

import re

line = 'some sentence     .'
re.sub('\s+(\.)', '', line)

But it removes the dot as well. Desired output would be like that

some sentence.
Emiliano
  • 79
  • 8

1 Answers1

0

try replace your regex with this \s{2,}

MaHarder
  • 11
  • 6