[Tutor] why is unichr(sys.maxunicode) blank?

eryksun eryksun at gmail.com
Sat May 18 05:28:55 CEST 2013


On Fri, May 17, 2013 at 11:06 PM, Dave Angel <davea at davea.name> wrote:
> One tool that can help is the name function in module unicodedata
>
>  >>> import unicodedata
>  >>> unicodedata.name(u'\xb0')
> 'DEGREE SIGN'
>
> If you try that on the values near sys.maxunicode you get an exception:
> ValueError: no such name

There's no name since the code point isn't assigned, but the category
is defined:

    >>> unicodedata.category(u'\U0010FFFD')
    'Co'
    >>> unicodedata.category(u'\U0010FFFE')
    'Cn'
    >>> unicodedata.category(u'\U0010FFFF')
    'Cn'

'Co' is the private use category, and 'Cn' is for codes that aren't assigned.


More information about the Tutor mailing list