[Tutor] decimal precision

Michael Connors connorsml at gmail.com
Tue Mar 25 15:05:07 CET 2008


On 25/03/2008, elis aeris <hunter92383 at gmail.com> wrote:
>
> what if i want it only to 2nd decimal?
>
> what if i want to cut off everything behind decimal?
>


In: print "%.2f" % (0.999999)
Out: 0.99

http://docs.python.org/lib/typesseq-strings.html
-- 
Michael Connors
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080325/ab5d4893/attachment.htm 


More information about the Tutor mailing list