ValueError: invalid literal for int(): 1.0000000000e+00

Fredrik Lundh fredrik at pythonware.com
Mon Feb 14 13:03:33 EST 2005


Terry Reedy wrote:

> int(somestring) without a radix argument requires that somestring be an decimal integer literal 
> and nothing more and nothing else.

but specifying a radix won't help you, though:

>>> int("1.0", 10)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: invalid literal for int(): 1.0
>>> int("1e+10", 10)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: invalid literal for int(): 1e+10
>>> int("1.0000000000e+10", 10)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: invalid literal for int(): 1.0000000000e+10

</F> 






More information about the Python-list mailing list