float does not parse '0.000000E+00'

Paolo Redaelli redaelli at inc.it
Sat Jun 3 16:41:09 EDT 2000


1st of all, cheers to everyone!

I need to parse numbers coming from a file (made by a fortran program)
the problem comes when parsing 
When I made some tests on the shell they went fine, like this:

=======================
>>> a = "0.000000E+00"
>>> float(a)
0.0
>>> 
============================

but if I run a program that does x=float(x) where x = "0.000000E+00 "
(being a string) here's the output. 

===========================
[paolo at aldebaran Telaio]$ ./pyplot.py
x(<type 'string'>)='0.000000E+00' y(<type 'string'>)='0.000000E+00'
Traceback (innermost last):
  File "./pyplot.py", line 198, in ?
    t = Telaio()
  File "./pyplot.py", line 172, in __init__
    x = float(x)
===========================
I looked into Python manuals adn found  that a float can't looks like an
octal. But an octal does NOT have the dot!

Thanks very much in advance for your attention,
	Paolo Redaelli



More information about the Python-list mailing list