Easy way to print numbers with thousand separators?

emile at fenx.com emile at fenx.com
Thu May 11 20:24:22 EDT 2000


>>> import locale
>>> locale.setlocale(locale.LC_ALL,"")
'English_United States.1252'
>>> print locale.format("%12.2f",1234567.89,1)
  1,234,567.89

Emile van Sebille
emile at fenx.com

John Villalovos <john at nwjohn.jf.intel.com> wrote in message
news:<8ffdtg$dav$1 at nwjohn.jf.intel.com>...
> I was wondering if there was an easy way to print numbers with thousand
> separators in them?
> 
> For example I want to print the number:  1234567890
> 			            as:  1,234,567,890
> 
> I know I can write a simple little program to do it but I was hoping that there
> was already something in the libraries to do this.
> 
> Thanks,
> John
> -- 
> http://www.python.org/mailman/listinfo/python-list
>




More information about the Python-list mailing list