gpt4 book ai didi

python - 如何打印所有 unicode 字符?

转载 作者:太空狗 更新时间:2023-10-29 17:37:15 25 4
gpt4 key购买 nike

我想打印一些 unicode 字符,但 u'\u1000'u'\u1099'。这不起作用:

for i in range(1000,1100):
s=unicode('u'+str(i))
print i,s

最佳答案

您需要使用 unichr()内置函数:

for i in range(1000,1100):
print i, unichr(i)

请注意,在 Python 3 中,只有 chr()就足够了。

关于python - 如何打印所有 unicode 字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7959740/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com