float does not parse '0.000000E+00'

Remco Gerlich scarblac-spamtrap at pino.selwerd.nl
Sat Jun 3 18:37:01 EDT 2000


Paolo Redaelli wrote in comp.lang.python:
> 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)
> ===========================

What is the exact error? You snipped the last line, with the message.

Maybe one your 'from module import *' commands redefines float?


-- 
Remco Gerlich,  scarblac at pino.selwerd.nl
"Early to rise, early to bed, makes a man healthy, wealthy and dead." -- TP



More information about the Python-list mailing list