Easy way to print numbers with thousand separators?
John Villalovos
john at nwjohn.jf.intel.com
Fri May 12 10:57:00 EDT 2000
Thanks!
But now when using a Red Hat 6.2 system when I type: import locale
I get the following:
Python 1.5.2 (#1, Feb 1 2000, 16:32:16) [GCC egcs-2.91.66 19990314/Linux\
(egcs- on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import locale
Traceback (innermost last):
File "<stdin>", line 1, in ?
File "/usr/lib/python1.5/locale.py", line 4, in ?
from _locale import *
ImportError: No module named _locale
>>>
I can see the locale.py, locale.pyc, & locale.pyo files in /usr/lib/python1.5/
Is there a configuration file option that will make it work?
Thanks,
John
In article <391B4F36.57EE6313 at fenx.com>, <emile at fenx.com> wrote:
>>>> 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