Currency format for floats?

Joseph Santaniello joseph at src.no
Thu Jun 1 19:58:57 EDT 2000


Ah, yes. But I'm still missing my commas... A nice clean way to do that?

Thanks for the tip!

Joe

On Thu, 1 Jun 2000, Ken Seehof wrote:

> >>> 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