I have to read a data file that contains numbers formatted with (very) old FORTRAN style. A line of the file looks like this:
4.500000+1 1.894719-3 4.600000+1 8.196721-3 4.700000+1 2.869539-3 The file (or large portion of it) contains these numbers in a fixed width format. The trouble with reading these numbers in Python is that there is no E in these numbers. Watch 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 be done. This is an old FORTRAN format so I thought perhaps someone had already figured it out. Does anyone know of a library to read numbers like this?
Ebefore the+or-and the Python have at the resulting string. (Assuming that's what it actually means).