Easy way to print numbers with thousand separators?

emile at fenx.com emile at fenx.com
Fri May 12 14:20:49 EDT 2000


<<apologies to those who get this twice - I mis-posted to the tutor
list>>

John,

This is because your copy of python was compiled without _locale
support.

You'll need to recompile to fix this.  This is how I do it on my RH6
system.
in dist/src/Modules, modify Setup by removing the leading # in the line:

#_locale _localemodule.c # access to ISO C locale support

I update python to the CVS version every couple of weeks.  I've got an
update
script in /usr/src/python that reads:
cvs -z6 -q up -P -d
cd dist/src
make clean
./configure --with-thread --prefix /usr
make
make test
make install

If you've installed the sources, you should be able to recompile
starting
with 'make clean' and on from above.

If recompiling isn't a real option, you'll need to adapt some code to 
do the formatting.  see http://deja.com/getdoc.xp?AN=588167809 for a
start.

HTH,

Emile van Sebille
emile at fenx.com


John Villalovos <john at nwjohn.jf.intel.com> wrote in message
news:<8fh63s$ds8$1 at nwjohn.jf.intel.com>...
> 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
>




More information about the Python-list mailing list