Rough draft: Proposed format specifier for a thousands separator

Hendrik van Rooyen mail at microcorp.co.za
Sat Mar 14 04:40:56 EDT 2009


"John Nagle" <nagle at animats.com> wrote:

>     Yes.  In COBOL, one writes
> 
> PICTURE $999,999,999.99
> 
> which is is way ahead of most of the later approaches.

That was fixed width. For zero suppression:

PIC $$$$,$$$,$99.99  

This will format 1000 as $1,000.00

For fixed width zero suppression:

PIC $ZZZ,ZZZ,Z99.99

gives a fixed width field - $     1,000.00
with a fixed width font, this will line the column up,
so that the decimals are under each other.

- Hendrik





More information about the Python-list mailing list