Or...
{{=T('$%i.%.2i',(int(total),int(100.0*(total-int(total))))}}
and use web2py to translate '$%i.%.2i'
Massimo
On Nov 19, 11:24 am, "Wes James" <[EMAIL PROTECTED]> wrote:
> I have an amount that I want to format as 4500 -> $4,500.00.
>
> Is there a routine to do this in web2py? I tried import locale in the
> controller and then use {{=locale.format('$%.2f', amount,True)}} in my
> layout, but I get locale is not defined.....
>
> well, never mind. I just got this to work:
>
> {{import locale}}
> {{locale.setlocale(locale.LC_ALL,('en','ascii'))}}
> {{='$' + locale.format('%.2f',total,True)}}
>
> is there a better way to do this in a file.html file?
>
> thx,
>
> -wj
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---