> -----Original Message----- > Date: Mon, 19 Mar 2007 11:53:06 -0400 > From: Kent Johnson <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Making table > To: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > 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 > What if one wished to align the values in each column at the decimal point? Is there a simple means to do this in Python, or would one need to write a new function?
Regards, Barry [EMAIL PROTECTED] 541-302-1107 ________________________ We who cut mere stones must always be envisioning cathedrals. -Quarry worker's creed _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor