I have a text file that I am trying to read and receive string with brackets and convert it into a float array.
The text file reads as:
[0.1, 0.4242230677806444]
and the string I read from the text file using the following scripts:
testsite_array = []
with open('BestIndividuals_Gen.txt') as my_file:
for line in my_file:
testsite_array.append(line)
gives a string like "[0.1, 0.4242230677806444]"
but how can I convert this string with brackets into float array?