linda.s wrote:
> On 5/28/06, Bob Gailer <[EMAIL PROTECTED]> wrote:
>>  linda.s wrote:
>>  When I test the following code,
>> I got something like (use 80 as argument):
>> 80?F=27?C
>> Why '?' appear?
>>
>> # code
>> print '%i\260F = %i\260C' % (int(fahrenheit), int(celsius+.5))
>>
>>  On my computer I get the desired result. I paste it here 80°F = 27°C and I
>> see degree symbols.
>>
>>  What operating system / terminal hardware are you using?
>>  --
>> Bob Gailer
>> 510-978-4454
> 
> mac and terminal.

\260 represesents the character with octal value 260, hex B0. In Latin-1 
and Unicode this is a degree sign. My guess is that your terminal is set 
to display UTF-8 characters rather than latin-1; in UTF-8 B0 by itself 
is an error. It's also possible it is set to MacRoman but in that case I 
think you would see an infinity sign instead of a question mark.

 From the Python interpreter prompt, type
import sys
sys.stdout.encoding

to see what encoding your terminal is set to. If it is UTF-8, change the 
\260 to \xc2\xb0 which is the correct sequence for a degree sign in 
UTF-8. If it is MacRoman, change the \260 to \xa1

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to