Re: How convert string '1e7' to an integer?
On Sat, Nov 7, 2009 at 8:17 PM, Peng Yu <email@example.com> wrote:
> It seems that int() does not convert '1e7'. I'm wondering what
> function to use to convert '1e7' to an integer?
> Traceback (most recent call last):
> *File "<stdin>", line 1, in <module>
> ValueError: invalid literal for int() with base 10: '1e7'
Whenever you use that notation, you always get a float
So to convert '1e7' to a number, you need to use float('1e7') which
you can then convert to an int
|All times are GMT. The time now is 08:49 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.