formattazione cifra con decimali

Jerry Hill malaclypse2 at
Tue Jan 9 08:34:44 EST 2007

On 9 Jan 2007 01:43:41 -0800, Nuke <andrea.massa at> wrote:
> I need to visualize a number (or a string of that number) using the
> decimal separator.
> i have this number visualized: 50320,12 and i need that the
> visualization of this number is: 50.320,13.
> There is a function that directly convert the number (or the string) ?

I'm not very familiar with locale-aware programming in Python, but
this may get you started:

>>> import locale

>>> locale.setlocale(locale.LC_ALL, 'it')

>>> locale.format("%0.2f", 50320.12, grouping=True)

See for documentation on
the locale module.


More information about the Python-list mailing list