Re: Get alternative char name with unicodedata.name() if no formal one defined

2010-10-14 Thread John Machin
s no programatically-available list of those names. Try something like: name = unicodedata.name(x, some_default) if x > u"\x1f" else ("NULL", etc etc, "UNIT SEPARATOR")[ord(x)] or similarly with a prepared dict: C0_CONTROL_NAMES = { u"\x00": "NULL"

Get alternative char name with unicodedata.name() if no formal one defined

2010-10-14 Thread Dirk Wallenstein
Hi, I'd like to get control char names for the first 32 codepoints, but they apparently only have an alias and no official name. Is there a way to get the alternative character name (alias) in Python? -- Greetings, Dirk -- http://mail.python.org/mailman/listinfo/python-list

Re: unicodedata.name

2006-02-01 Thread Szabolcs Nagy
thank you (it's so obvious i don't know how i could misunderstand) -- http://mail.python.org/mailman/listinfo/python-list

Re: unicodedata.name

2006-02-01 Thread Fredrik Lundh
is the difference between "no name defined" and "not given"? "no name is defined" refers to the unicode database, "not given" refers to the default argument. if you don't specify a default, and the character don't have a known name, you get a ValueEr

unicodedata.name

2006-02-01 Thread Szabolcs Nagy
;not given"? eg. '\n' why gives a ValueError? >>> unicodedata.name(u'\n') Traceback (most recent call last): File "", line 1, in ? ValueError: no such name -- http://mail.python.org/mailman/listinfo/python-list