I have data that has strings with floating numbers like
"['0.0'" and '82.00.0' and '82.0\n'
and I only want to extract floating points till two/one decimal points like so-
"['0.0'" and '82.00.0' and '82.0\n' to 0.0, 82.0, 82.0
The data structure is a big quoted CSV like:
"0.0, 82.00.0,...., 82.0\n"
I'm iterating through these to store them to the temp
tempprices.split(',')
temp =[]
for n in range(l, len(tempprices)-1):
temp.append(map(ast.literal_eval,re.findall(r'(?<!\S)[+-]?\d+\.\d{1,2}(?!\.*\d)',tempprices[n])))
where l is some index value.
I want to append these to temp
like so [0.0, 82.0, 82.0]
How to achieve that?