Floating point format

Martin v. Loewis martin at v.loewis.de
Fri May 24 18:30:42 EDT 2002


jb <jblazi at hotmail.com> writes:

> On my system floating points are displayed as 12.34.
> Is there a simple possibility to have 12,34 instead? Of course I could look 
> at the output of '%4.1f' % x and replace the '.' by a ',', but is there a 
> more elegant way?

You need to use locale.setlocale, then locale.format.

HTH,
Martin



More information about the Python-list mailing list