Re: [Tutor] Float and decimal spaces

2007-08-04 Thread Eric Walker
--- Kent Johnson <[EMAIL PROTECTED]> wrote: > Toon Pieton wrote: > > Hey all! > > > > My memory seem to have a horrible leak. How does > one limit the amount of > > decimal spaces for a float? I used to know that... > > > > Example: not 5.398042156, but 5.4 (if I decide to > have only one plac

Re: [Tutor] Float and decimal spaces

2007-08-04 Thread Kent Johnson
Toon Pieton wrote: > Hey all! > > My memory seem to have a horrible leak. How does one limit the amount of > decimal spaces for a float? I used to know that... > > Example: not 5.398042156, but 5.4 (if I decide to have only one place). For printing, use %.1f : In [2]: print '%.1f' % 5.39804215

[Tutor] Float and decimal spaces

2007-08-03 Thread Toon Pieton
Hey all! My memory seem to have a horrible leak. How does one limit the amount of decimal spaces for a float? I used to know that... Example: not 5.398042156, but 5.4 (if I decide to have only one place). Thanks in advance! Toon Pieton. ___ Tutor maill

Re: [Tutor] Float and decimal spaces

2007-08-03 Thread Luke Paireepinart
Toon Pieton wrote: > Hey all! > > My memory seem to have a horrible leak. How does one limit the amount > of decimal spaces for a float? I used to know that... > > Example: not 5.398042156, but 5.4 (if I decide to have only one place). Usually you do this during display, while you leave the actual