atof problem.

Bjorn Pettersen bjorn at roguewave.com
Fri Jul 14 14:29:56 EDT 2000


William Dandreta wrote:
> 
> I am having a problem with the atof function. I tried to convert 1,142.00 to
> a float but the comma causes a problem. I resolved the problem by removing
> the comma but there must be a better way.
> 
> I looked in the documentation and there was mention of the $LANG
> environmental variable but it did not tell haw to use it. Also, it mentioned
> settings could be made using the functions in locale module. I tried to
> import the locale module but I get an error message that the _locale module
> doesn't exist.

Yes, the _locale module doesn't seem to be compiled in by default on
most *nix systems (it works great on Windows, but I'm sure that's as
helpful to you as it is to me <wink>)

Using the locale module is definitely the right way to do this though,
so your best bet is probably to recompile Python...

-- bjorn




More information about the Python-list mailing list