I have some trouble transforming a string into an array. The separators between numbers are spaces, and the thousands also.
My string is this:
'25 127,4 17 588,6 16 264,3 324,4 8,7'
I want it to look like this:
['25 127,4', '17 588,6', '16 264,3', '324,4', '8,7']
or better like this:
['25127,4', '17588,6', '16264,3', '324,4', '8,7']
I was trying to use regex and findall to do so, but the problem is that it only captures 5-digit numbers.
My code is kind of like this:
a = '25 127,4 17 588,6 16 264,3 324,4 8,7'
print(re.findall(r'\d+\s\d+,\d{1}', a))
which gives me this output:
['25 127,4', '17 588,6', '16 264,3', '4 8,7']
How to solve this?
(?! )[\d ]+,\dre.findall(r'[0-9\s]+,\d+', s)given a strings?