【发布时间】:2021-09-10 04:06:24
【问题描述】:
我正在测试函数isprintable()。我想打印字符串string.whitespace + unicodedata.lookup("GREEK SMALL LETTER ALPHA")中所有字符的Unicode NAMES。
如何打印所有名称 - 例如'SPACE'、'NO-BREAK SPACE'、HORIZONTAL TAB、'GREEK SMALL LETTER ALPHA。
import unicodedata, string
for e in string.whitespace + unicodedata.lookup("GREEK SMALL LETTER ALPHA"):
print(ord(e))
print(unicodedata.name(e))
我收到错误“ValueError:没有这样的名称”
32
SPACE
9
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
ValueError: no such name
【问题讨论】:
-
嗯,it seems like that's by design。虽然它不是很有帮助。我很确定还有另一个问题涉及如何处理。看着...
标签: python unicode python-unicode