如何通过描述性名称查找unicode字符?

威姆

尝试通过python 2.7中的(唯一)名称获取unicode字符。我在文档中找到的方法不适用于我:

>>> import unicodedata
>>> print unicodedata.lookup('PILE OF POO')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: "undefined character name 'PILE OF POO'"
博德温

问题是,PILE OF POO是Unicode 6引入的。但是,的数据unicodedata大多是5.X左右的较旧版本。文档说:

该模块使用与UnicodeData File Format 5.2.0定义的名称和符号相同的名称和符号(请参见http://www.unicode.org/reports/tr44/tr44-4.html)。

不幸的是,这意味着几乎所有的表情符号和象形文字(如果您是埃及人)也很不走运

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章