I need to read a data file containing numbers formatted by the (very) old FORTRAN style. The file line is as follows:
4.500000+1 1.894719-3 4.600000+1 8.196721-3 4.700000+1 2.869539-3
The file (or most of it) contains these numbers in a fixed-width format. The problem with reading these numbers in Python is that there is no E in these numbers. See what happens:
>>> float('4.50000+1') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for float(): 4.50000+1
I can write a parser to read this, but wanted to know if this has already been done. This is the old FORTRAN format, so I thought that maybe someone already understood this. Does anyone know a library to read such numbers?
source share