As part of the preprocessing of my data. I want to be able to replace the space followed by a number, keeping the space followed by the character. For instance:
Input String: '8.1.7 Sep 2000 Dec 2004 Dec 2006 Indefinite'
Expected output: '8.1.7,Sep 2000,Dec 2004,Dec 2006,Indefinite'
I am using an expression-based replacement function in python:
re.sub("\s+", ",", release)
but this will not produce the desired result, simply because it means replacing all spaces, not sure how to save the one followed by the characters, i.e. [a-z].
Or maybe I need to rethink the approach.
Count source
share