String formatting (%)

Peter Hansen peter at engcorp.com
Wed Apr 28 09:15:02 EDT 2004


Pascal wrote:

> Hello,
> I've a float number 123456789.01 and, I'de like to format it like this
> "123 456 789.01".
> Is this possible with % character?

No, as shown by http://docs.python.org/lib/typesseq-strings.html
but you could probably use the 'locale' module instead.

I suspect there's also a regular expression that could deal with
that, but I don't want to know what it is. ;-)

-Peter



More information about the Python-list mailing list