a simple unicode question
Scott David Daniels
Scott.Daniels at Acm.Org
Wed Oct 21 03:14:06 EDT 2009
George Trojan wrote:
> Scott David Daniels wrote:
...
>> And if you are unsure of the name to use:
>> >>> import unicodedata
>> >>> unicodedata.name(u'\xb0')
>> 'DEGREE SIGN'
> Thanks for all suggestions. It took me a while to find out how to
> configure my keyboard to be able to type the degree sign. I prefer to
> stick with pure ASCII if possible.
> Where are the literals (i.e. u'\N{DEGREE SIGN}') defined? I found
> http://www.unicode.org/Public/5.1.0/ucd/UnicodeData.txt
> Is that the place to look?
I thought the mention of unicodedata would make it clear.
>>> for n in xrange(sys.maxunicode+1):
try:
nm = unicodedata.name(unichr(n))
except ValueError: pass
else:
if 'tortoise' in nm.lower(): print n, nm
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list