Odd ValueError using float

Chris Angelico rosuav at gmail.com
Fri Mar 13 18:14:01 EDT 2015


On Sat, Mar 14, 2015 at 9:10 AM, emile <emile at fenx.com> wrote:
> (Pdb) decval
> '4'
> (Pdb) len(decval)
> 1
> (Pdb) int(decval)
> *** ValueError: invalid literal for int() with base 10: '41.700000000000003'
> (Pdb)
>
>
> Any ideas?

What's type(decval) tell you? I suspect you may have something other
than a string, even though it looks like a string in its repr.

ChrisA



More information about the Python-list mailing list