Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #87389

Re: Odd ValueError using float

References <mdvn81$3jp$1@ger.gmane.org>
Date 2015-03-14 09:14 +1100
Subject Re: Odd ValueError using float
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.338.1426284851.21433.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, Mar 14, 2015 at 9:10 AM, emile <emile@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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Odd ValueError using float Chris Angelico <rosuav@gmail.com> - 2015-03-14 09:14 +1100

csiph-web