I have strings in the following format in a text file. The following example has two lines.
[5.00186009e-01 3.77071140e-03 3.95659741e+00 1.89513038e+00 5.60401088e+00 7.09885871e-01]
[0. 0. 3.14860986 2.70311793 6.28318531 1.51787342]
I read it line by line and for each line I am using the following code to extract the numbers in a float list.
param_list = [float(i) for i in re.findall(r"[-+]?(?:\d*\.\d+|\d+)", line)]
It works well for the second line when the floats are not in scientific notation. How can I modify the regex to allow it to handle the scientific notations?
Thanks.