Dave Kuhlman wrote: > Try ljust and rjust. They are string functions/methods and are > described here: http://docs.python.org/lib/string-methods.html > > Something like the following might work for you: > > In [1]: value = 3.45678 > In [2]: ("%0.3f" % value).rjust(10) > Out[2]: ' 3.457'
Most string formatting conversions allow you to specify a width directly. For example, In [61]: value = 3.45678 In [63]: "%10.3f" % value Out[63]: ' 3.457' Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor