[reportlab-users] banking formatting of numbers
Matej Pivoluska
pivoluska at matfyz.cz
Sat Mar 5 03:31:22 EST 2005
Dňa So 5. Marec 2005 04:21 Timothy Smith napísal(a):
> Matej Pivoluska wrote:
> >Dňa So 5. Marec 2005 00:41 Timothy Smith napísal(a):
> >>is ther a way using reportlab i can format numbers 100,000.00 etc,
> >>instead of 100000.00?
> >
> >Just use format() function from locale module to get this. (And do not
> > forget to set the locale with function setlocale() before the use of the
> > locale.format().)
> >
> >mP
>
> cool can you give an example? i'm just reading about it now
import locale
#sets the LC_NUMERIC locale to your default settings
locale.setlocale(locale.LC_NUMERIC, "")
#prints "12 479,50" (I have "sk_SK" locale by default)
locale.format("%.2f", 12479.5, 3)
mP
--
http://pivoluska.blog.sme.sk/
More information about the reportlab-users
mailing list