European Win32. Python weirdness

Jeff Shannon jeff at ccvcorp.com
Fri Apr 19 14:28:41 EDT 2002


In article <3CC03738.2725CC26 at atlsci.com>, aboufer at atlsci.com 
says...
> Greetings all,
> 
> I am having problems with a module of python, mainly on Win32 platform
> using European languages. In some of the code we wrote, python does not
> seem to recognise a
> number as a number. More specificcaly, when python reads a string of
> digits, 'he' does not
> recognise it as a number but as a string. This of course causes the
> reste of the processing to fail!

It's hard to be sure without seeing your code, but this is 
probably normal/expected behavior.  The raw_input() function, 
which gets user input, will always return a string.  If a 
numerical value is expected, then it should be converted with a 
call to int() or float().  Similarly, reading and writing to 
files is normally done with strings, and can be converted to 
numbers in the same way.  There are other ways to get numerical 
input, but generally reading it as a string and then converting 
to the expected/desired number type is the safest way to go.

If you post a few segments of your code that are exhibiting this 
issue, then we can perhaps offer more specific suggestions.

-- 

Jeff Shannon
Technician/Programmer
Credit International



More information about the Python-list mailing list