formatting numbers for output
Emile van Sebille
emile at fenx.com
Sun Feb 18 12:44:18 EST 2001
Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)]
on win32
Type "copyright", "credits" or "license" for more
information.
IDLE 0.6 -- press F1 for help
>>> import locale
>>> locale.setlocale(locale.LC_ALL,"")
'English_United States.1252'
>>> print locale.format("%8.2f" , 4123.45, 1)
4,123.45
>>>
--
Emile van Sebille
emile at fenx.com
-------------------
"Fernando RodrÃguez" <spamers at must.die> wrote in message
news:9sfv8t45ve3dpql39rmp7082gibbicf56b at 4ax.com...
> Hi!
>
> How can I format a number so it pretty prints:
>
> 15,456.6 instead of 15456.6 ?
>
> TIA
>
>
>
>
> //-----------------------------------------------
> // Fernando Rodriguez Romero
> //
> // frr at mindless dot com
> //------------------------------------------------
More information about the Python-list
mailing list