def __init__(self, unicodeHexValue, block):
""" Set up a unicode character.
Arguments:
unicodeHexValue -- an integer that should correspond to a
Unicode code point.
block -- the CharacterBlock this character belongs to.
Raises:
ValueError -- if unicodeHexValue is not a valid code point.
"""
if unicodeHexValue < 0 or unicodeHexValue > 0x10FFFF:
raise (ValueError, "numeric value outside Unicode range")
self.unicodeHexValue = unicodeHexValue
""" Use name check to filter out unused characters.
unicodedata.name() raises ValueError for these
"""
self.chr = chr(self.unicodeHexValue)
self.name = unicodedata.name(self.chr)
self.equivalents = {}
self._block = block
transliterator.py 文件源码
python
阅读 18
收藏 0
点赞 0
评论 0
评论列表
文章目录