I have sentences like this - \"this is a test. 4.55 and 5,000.\" I want to remove the period at the end of the sentences, but not between numbers. My output has to be - \"this
How about
pattern = re.compile(r'\.(\s)') wordList = pattern.sub(r'\1', wordList)
This replaces a period followed by a space with just the space.