最大unicode码点索引

2024-04-23 08:18:46 发布

您现在位置:Python中文网/ 问答频道 /正文

>>> i = 0
... while True:
...     try:
...         chr(i)
...     except ValueError:
...         print(i)
...         break
...     i += 1
...         
1114112

这个号码在stdlib的什么地方吗?目前,我正在从chr.__doc__unichr.__doc__在python2上)解析它,这看起来很蹩脚。你知道吗

参数的有效范围取决于Python的配置方式—它可以是UCS2[0..0xFFFF]或UCS4[0..0x10FFFF]。我不确定是否还有其他范围。你知道吗


Tags: true参数doc地方号码printtryvalueerror
1条回答
网友
1楼 · 发布于 2024-04-23 08:18:46

这是^{}

An integer giving the value of the largest Unicode code point, i.e. 1114111 (0x10FFFF in hexadecimal).

Changed in version 3.3: Before PEP 393, sys.maxunicode used to be either 0xFFFF or 0x10FFFF, depending on the configuration option that specified whether Unicode characters were stored as UCS-2 or UCS-4.

相关问题 更多 >