unicodedata.name

S

Szabolcs Nagy

the unicodedata manual sais:
"
name( unichr[, default])
Returns the name assigned to the Unicode character unichr as a
string. If no name is defined, default is returned, or, if not given,
ValueError is raised.
"
what is the difference between "no name defined" and "not given"?
eg. '\n' why gives a ValueError?
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: no such name
 
F

Fredrik Lundh

Szabolcs said:
the unicodedata manual sais:
"
name( unichr[, default])
Returns the name assigned to the Unicode character unichr as a
string. If no name is defined, default is returned, or, if not given,
ValueError is raised.
"
what 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 ValueError.
eg. '\n' why gives a ValueError?

Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: no such name

the Unicode standard doesn't specify names for control characters.

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top