I have a string, which contains a list of real numbers, for example, '[0.0, 6.5, 3.0]'
How can I convert it to list of real numbers?
In my python program I read a csv file and there is a column with color triplets. When I get them, I can't work with them, because they aren't lists with real numbers. I tried to convert, but when I go through the list there is a mistake, because the point that separates the integer and fractional part is not a number.
if j == 'color':
color_triple = []
triple = ''.join(lines[i][j])
for i_ in range(1, len(triple)):
index = i_
while triple[index] != ',':
color = ''
color += triple[i_]
index += 1
color_triple.append(float(color))
i_ = index
I want to have a list [0.0, 6.5, 3.0]
and work with elements of list as they are float.