Formatting numbers
Aahz Maruch
aahz at netcom.com
Wed Sep 8 13:48:59 EDT 1999
In article <008401bef9dc$c0ff22e0$f29b12c2 at secret.pythonware.com>,
Fredrik Lundh <fredrik at pythonware.com> wrote:
>Ken Koller <ken.koller at kla-tencor.com> wrote:
>>
>> for array in list:
>> for number in array:
>> print '%+10.4f' % (number,),
>> print
>
>footnote: there's no need to wrap the value
>in a singleton tuple:
>
> print '%+10.4f' % number,
footnote ^ 2: No need, yes, but strongly recommended anyway. Makes it a
lot simpler if/when you modify the format string, particularly if you
intend your code to be used by Python newbies. BTW, even that trailing
comma is unneeded.
--
--- Aahz (@netcom.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6 (if you want to know, do some research)
More information about the Python-list
mailing list