Currency format for floats?
Ken Seehof
12klat at sightreader.com
Thu Jun 1 19:04:34 EDT 2000
>>> x = 34.9
>>> s = "$%.2f" % x
>>> print s
$34.90
Read more in "More String Operations" in the "Python Library Reference"
Joseph Santaniello wrote:
> Hi,
>
> I have an SQL query which I can format to give me a nice value like
> 23,342.40 which Python squashes into 23342.4 when I stick it into a
> list element. Is there a nice way to format floats so they look like
> (US) currency?
>
> Thanks,
>
> Joe
More information about the Python-list
mailing list