Answer the question
In order to leave comments, you need to log in
Did I write the regular expression correctly to remove the space before the punctuation mark?
Example:
a Greek was driving across a river. sees a Greek in the river cancer? put the hand of the Greek into the river, cancer by the hand of the Greek tsap!
Need to:
rode a Greek across the river. sees a Greek in the river rak? put the hand of the Greek into the river, cancer by the hand of the Greek tsap!
I wrote this: Do
you think it's okay? How else can you?
re.sub("[^(\S)](?=[\.,?!])", r"\1", text)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question