Format a number as currency! I can't find any help on this simple problem.
Ben Finney
bignose+hates-spam at benfinney.id.au
Tue Oct 10 23:46:17 EDT 2006
Richard Kessler <richard.kessler at matteicos.com> writes:
> I am relatively new to Python. Love it, but I find things that I
> can do easily in .NET and cannot find a way to do in Python. I need
> to format a number as currency, for example 12343.56 to $12,343.56.
>
> In C# all I need to do is decimal x = 12343.56 then
> x.ToString("$###,###.00");
Rather than implement a custom format, Python provides the 'locale'
module to handle locale-specific things like digit-grouping.
<URL:http://docs.python.org/lib/module-locale>
--
\ "About four years ago, I was -- no, it was yesterday." -- |
`\ Steven Wright |
_o__) |
Ben Finney
More information about the Python-list
mailing list