[Tutor] a question about symbol
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Sun May 28 22:50:27 CEST 2006
>> Let's compare the output to what we think is producing it. The very
>> last statement in the program looks like the thing we want to watch:
>>
>> print '%i\260F = %i\260C' % (int(fahrenheit), int(celsius+.5))
>>
>> One thing that caught me off guard is the '\260' thing. Can you explain
>> what that is for?
>
> It is a sample code i downloaded. I think it is the symbol put before F
> or C ( should be a small circle)...\I do not know why it appeared "?"
Hi Linda,
Ok, let's restate the question then. The question really seems to be:
"How do I print a 'degree' symbol on the screen?" Does that sound right
to you?
Unfortunately, this is not such a fun problem to solve. It really depends
on our output device --- the terminal --- and the support that our output
device gives us. Some terminal displays don't provide much graphical
support at all. In this case, you're seeing a question mark because the
terminal has no clue how to render the character we're trying to display.
Other terminals accept and display Unicode or other extended character
sets, but it sounds like yours may not.
You may want to read "The Absolute Minimum Every Software Developer
Absolutely, Positively Must Know About Unicode and Character Sets (No
Excuses!)" because it gives more background information on this ugly
mess:
http://www.joelonsoftware.com/articles/Unicode.html
If it isn't too much of a deal for you, just change '\260' to 'degrees'.
*grin*
Best of wishes!
More information about the Tutor
mailing list