How to add one blank after period
Question:
There is a sentence. How to add one blank after period by regex in Python, between ‘glabrous’ and ‘fruit’.
I try re.sub, but still have no idea.
sent1 = ‘pistils 1.7 mm long, glabrous.fruit ellipsoid’
to
sent2 = ‘pistils 1.7 mm long, glabrous. fruit ellipsoid’
Answers:
This should do it re.sub('.(?!s|d|$)', '. ', sent1)
There is a sentence. How to add one blank after period by regex in Python, between ‘glabrous’ and ‘fruit’.
I try re.sub, but still have no idea.
sent1 = ‘pistils 1.7 mm long, glabrous.fruit ellipsoid’
to
sent2 = ‘pistils 1.7 mm long, glabrous. fruit ellipsoid’
This should do it re.sub('.(?!s|d|$)', '. ', sent1)