Problems with conversion of values in strings to integers

Erik Max Francis max at alcyone.com
Mon Oct 6 15:19:59 EDT 2003


Karl Scalet wrote:

> depending on what you actually want,
>  >>> int(round('10.1'))
> might be appropriate.
> But if you really want the "floor"-value,
> nothing is wrong with your approach.

round actually takes a float as an argument, not a string, so you
probably meant

	int(round(float('10.1')))

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ Tell me the truth / I'll take it like a man
\__/  Chante Moore




More information about the Python-list mailing list