[尝试通过python 2.7中的(唯一)名称获得unicode字符。我在docs中找到的方法不适用于我:
>>> 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)定义的相同的名称和符号。
[不幸的是,这意味着几乎所有Emoji and hieroglyphs都使您不走运(如果您是埃及人)。