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.398042156 5.4 If you want to limit the precision of computations maybe the Decimal module would help. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor