Here's a little function I wrote that you may have:
def formatAsDollars(amount):
dollars = int(amount)
cents = amount - dollars
i = 0
reverseDollarPlaces = []
for p in str(dollars)[::-1]:
if i % 3 == 0 and i:
reverseDollarPlaces.append(',')
reverseDollarPlaces.append(p)
i += 1
return '$%s.%.2i' % (''.join(reverseDollarPlaces[::-1]), int(100*cents))
On Tue, Dec 23, 2008 at 2:32 PM, Shay Ben Dov <[email protected]> wrote:
>
> Hi,
>
> I know that if
>
> sum = 560000.0
>
> then
>
> {{ sum|floatformat:2 }} will display 560000.00
>
> How we get $560,000.00
>
> Thanks,
>
> Shay Ben Dov
>
>
>
> >
>
--
http://giscoder.blogspot.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" 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/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---