On Mon, Jul 20, 2009 at 5:07 PM, Egon Frerich<egon.frer...@nord-com.net> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I want to format values to the german form eg. 1.034,56 but > locale.format() doesn't work for me. > > Here is a little test program: ... > k1 = locale.format_string('%12s',k,True)
I don't think you want to be using '%s' to format numbers in your format strings. Instead, use '%f' to format floating point values. As I understand it, a %s in a format string actually calls str() on the object that you pass into the formatting function, and I don't think that floats (or Decimal.Decimal objects) take locale into account when you do that. -- Jerry -- http://mail.python.org/mailman/listinfo/python-list