打印 unicode 字符 NAMES - 例如'希腊小写字母 ALPHA' - 而不是 'α'

问题描述

我正在测试函数 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: no such name'

32
SPACE
9
Traceback (most recent call last):
  File "<stdin>",line 3,in <module>
ValueError: no such name

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)