[gtk] troubles with string -> float conversion

Ulrich Berning berning at teuto.de
Wed Apr 18 19:34:27 EDT 2001


L'Ordinateur du Particulier wrote:

> Hi,
>
> i have some problems with string to float conversion in python
>
> before importing gtk module, the string "6.6" is converted into float
> without problem, but after the gtk module has been imported,
> the syntax "6.6" is invalid, python's waiting "6,6" ...
>
> the float() function seems to have been overwritten !?
>
> is there a way to choose which decimal separator to use ?
>
> Regards
>
> Fabrice PIERROT

Hi,

I use the following statements in nearly all python main programs
after the import of all other modules:
--------------------

import locale
locale.setlocale(locale.LC_ALL, '')       # Use preferred locale for
sorting etc.
locale.setlocale(locale.LC_NUMERIC, 'C')  # Use default C locale for
numbers

--------------------
Regards Ulli

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20010419/64e9f4a9/attachment.html>


More information about the Python-list mailing list