[Baypiggies] scientific notation: string to int

Keith Dart keith at dartworks.biz
Wed Dec 8 23:46:07 CET 2010


=== On Wed, 12/08, Jeff Sheldon wrote: ===
> In python 2.6 (and later) float() works for this...
> 
> In [15]: float('2.96116E+11')
> Out[15]: 296116000000.0
===

Earlier versions, also:

>>> import sys
>>> sys.version
'2.4.3 (#1, Nov 11 2010, 13:34:43) \n[GCC 4.1.2 20080704 (Red Hat4.1.2-48)]'
>>> float('2.96116E+11')
296116000000.0


-- Keith Dart

-- 

-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Keith Dart <keith at dartworks.biz>
   public key: ID: 19017044
   <http://www.dartworks.biz/>
   =====================================================================


More information about the Baypiggies mailing list