LC_MONETARY formatting

Colin Fox cfox at cfconsulting.ca
Fri Jan 9 17:19:09 EST 2004


Hi, all.

This feels like a stupid question to me, but I've scoured the Internet
(yes, the whole thing! :) and I can't find a single example of using the
locale module to format money.

So I have:

cash = 12345.6

and the locale is set to "en_CA" (though that doesn't matter, really).

I would like to be able to print "$12,345.60"

Is there a format string, or function, or *something* that will take
advantage of the monetary formatting info in the locale object? Or did
they provide all that formatting information just so that I have to write
it myself?

The only docs on using the locale object contain a single example of
comparing two strings. It would sure be nice to see examples of each of
the locale features.

Any help would be GREATLY appreciated!

Thanks,
  cf



More information about the Python-list mailing list