[Numpy-discussion] ValueError: invalid literal for float()

Nils Wagner nwagner@iam.uni-stuttgart...
Fri Feb 27 09:20:46 CST 2009


Hi all,

Is it possible to modify the behaviour of float wrt
the following situation

  
>>> permas_M[0,2]
'1.5699999809265137D+01'
>>> float(permas_M[0,2])
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ValueError: invalid literal for float(): 
1.5699999809265137D+01

The following works.

>>> permas_M[0,2] = '1.5699999809265137E+01'
>>> permas_M[0,2]
'1.5699999809265137E+01'
>>> float(permas_M[0,2])
15.699999809265137

Nils


More information about the Numpy-discussion mailing list