Remove integer from float number

Larry Bates larry.bates at websafe.com
Thu Mar 23 20:44:41 CET 2006


Derek Basch wrote:
> How can I return:
> 
> ".666"
> 
> from float:
> 
> "0.666"
> 
> This is what I have so far:
> 
>>>> "%.6f" % x
> 
> Thanks Everyone,
> Derek Basch
> 

This works but I'm not entirely sure I know what you are
trying to accomplish.

("%.3f" % x)[1:]


-Larry Bates



More information about the Python-list mailing list