Number Format

Frank Buss fb at frank-buss.de
Wed Aug 28 20:00:02 CEST 2002


Michael.Winter at tka-ger.thyssenkrupp.com (Michael) wrote:

> But I can't get the format 2.000. Has anyone an idea ?

Looks like you are searching for the German locale setting. According to 
the documentation you can use "locale.setlocale(locale.LC_ALL, 'de')", but 
this fails on Windows XP and on RedHat Linux with an "locale setting not 
supported" error. But with the undocumented (at least I didn't found it in 
the documentation) 'GERMAN' it works:

import locale
locale.setlocale(locale.LC_ALL, 'GERMAN')
locale.format('%s', 9823443553.5, 1)
'9.823.443.553,5'

-- 
Frank Buß, fb at frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de



More information about the Python-list mailing list