python - 是否有 Python 库可以为给定的 unicode 字符或字符串提供脚本名称?

标签 python unicode

是否有一个库可以告诉特定的 unicode 字符属于哪个脚本?

例如,对于输入“u'ሕ'”,它应该返回 Ethiopic 或类似的。

最佳答案

也许unicodedata中的数据模块就是你要找的:

print unicodedata.name(u"ሕ")

打印

ETHIOPIC SYLLABLE HHE

打印出来的名字可以用来查找对应的字符:

unicodedata.lookup("ETHIOPIC SYLLABLE HHE")

关于python - 是否有 Python 库可以为给定的 unicode 字符或字符串提供脚本名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4944377/

相关文章:

python - 为什么值列表在 Django 中保留过滤器?

python - 如何在修改旧值的 Pandas 中使用 `Series.interpolate`

javascript - 获取包含超过 0xffff 的 unicode 字符的字符串长度

python - 在 Python 3 中编码字符串而不使用 unicode\xc2 替换

regex - 正则表达式可以与其他语言一起使用吗?

windows - 如何在 Windows 控制台上输出 Unicode 字符串

python - 扩展 django 用户模型时出现属性错误?

python代码问题

python - Python 中的记忆化、类和多处理

java - 检查字符串是否可在 Gsm0338 中编码