I have a list that contents are:
a=['0.00244,-0.001908302,-0.001731396,0.002029896,0.000424,0.000291,0.000148\n']
So it contains one member that has numbers in it.
I tried to search for different methods to extract the numbers in float format, as in:
How to remove '\n' from end of strings inside a list?
Remove '\n' from each string stored in a python list
How to remove "\n" in a list of lists (python)
How to remove '\n' from end of strings inside a list?
But their difference with my case is that all of my numbers are inside one ''
, so once I use
a=[a[0].strip('\n')]
then the
a[0].split()
this gives me:
['0.00244,-0.001908302,-0.001731396,0.002029896,0.000424,0.000291,0.000148']
I can remove the \n
, but then I can not extract the numbers in any way. I wanted to split the commas away from the numbers to then remove them one by one, but it seems that split is not working in my case.