String to Float, without introducing errors

Paul St George email at paulstgeorge.com
Sat Dec 17 06:51:17 EST 2022


I have a large/long array of numbers in an external file. The numbers look like this:

-64550.727
-64511.489
-64393.637
-64196.763
-63920.2
-63563.037
-63124.156
-62602.254
-61995.895
-61303.548
-60523.651
-59654.66
...

When I bring the numbers into my code, they are Strings. To use the numbers in my code, I want to change the Strings to Float type because the code will not work with Strings but I do not want to change the numbers in any other way.

So, I want my Strings (above) to be these numbers.

-64550.727
-64511.489
-64393.637
-64196.763
-63920.2
-63563.037
-63124.156
-62602.254
-61995.895
-61303.548
-60523.651
-59654.66
...

Please help!












More information about the Python-list mailing list