I'm having trouble building a function that extracts words and real numbers, and replaces another symbols with empty spaces.
For example:
word1, word2.word3, 1.4056 -1.2456 40,50 -60$30 60.50. 70.40.
should become
word1 word2 word3 1.4056 -1.2456 40 50 -60 30 60.50 70.40
I tried with:
re.sub(r"[^a-zA-Z0-9.-]+", " ", input_string)
I almost have it, except 60.50. doesn't change (the trailing dot is still there). Could you help me please?
Try this:
Output: