AFAIK, WinXP supports setlocale
just fine.
If you want to do locale-aware conversions, try using locale.atof('2,34')
instead of float('2,34')
.
题
I'm trying to use the data collected by a form I to a sqlite query. In this form I've made a spin button which gets any numeric input (ie. either2,34
or 2.34
) and sends it in the form of 2,34
which python sees as str
.
I've already tried to float()
the value but it doesn't work. It seems to be a locale problem but somehow locale.setlocale(locale.LC_ALL, '')
is unsupported (says WinXP).
All these happen even though I haven't set anything to greek (language, locale, etc) but somehow Windows does its magic.
Can someone help?
PS: Of course my script starts with # -*- coding: utf-8 -*-
so as to have anything in greek (even comments) in the code.
解决方案
AFAIK, WinXP supports setlocale
just fine.
If you want to do locale-aware conversions, try using locale.atof('2,34')
instead of float('2,34')
.