如何确定 Python 是使用 UCS-2 还是 UCS-4 编译的? [英] How to find out if Python is compiled with UCS-2 or UCS-4?
问题描述
正如标题所说.
$ ./configure --help |grep -i ucs--enable-unicode[=ucs[24]]
搜索官方文档,我找到了这个:
<块引用>sys.maxunicode: 一个整数,给出最大支持的代码点Unicode 字符.这个价值取决于配置选项指定是否 Unicode字符存储为 UCS-2 或UCS-4.
这里不清楚的是 - 哪些值对应于 UCS-2 和 UCS-4.
该代码预计可在 Python 2.6+ 上运行.
使用 --enable-unicode=ucs4 构建时:
<预><代码>>>>导入系统>>>打印 sys.maxunicode1114111使用 --enable-unicode=ucs2 构建时:
<预><代码>>>>导入系统>>>打印 sys.maxunicode65535Just what the title says.
$ ./configure --help | grep -i ucs
--enable-unicode[=ucs[24]]
Searching the official documentation, I found this:
sys.maxunicode: An integer giving the largest supported code point for a Unicode character. The value of this depends on the configuration option that specifies whether Unicode characters are stored as UCS-2 or UCS-4.
What is not clear here is - which value(s) correspond to UCS-2 and UCS-4.
The code is expected to work on Python 2.6+.
When built with --enable-unicode=ucs4:
>>> import sys
>>> print sys.maxunicode
1114111
When built with --enable-unicode=ucs2:
>>> import sys
>>> print sys.maxunicode
65535
这篇关于如何确定 Python 是使用 UCS-2 还是 UCS-4 编译的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!