判断一个字符是否是组合变音符号

发布于 2024-07-14 17:02:23 字数 231 浏览 8 评论 0原文

如果您在 python (2.x) 中循环 chars 一个 unicode 字符串,请说:

ak.sɛp.tɑ̃

如何判断当前字符是否是组合变音符号?

例如,上面字符串中的最后一个字符实际上是一个组合标记:

ak.sɛp.tɑ̃ --> ̃

if you're looping though the chars a unicode string in python (2.x), say:

ak.sɛp.tɑ̃

How can you tell whether the current char is a combining diacritic mark?

For instance, the last char in the above string is actually a combining mark:

ak.sɛp.tɑ̃ --> ̃

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柏林苍穹下 2024-07-21 17:02:23

使用 unicodedata 模块:

import unicodedata
if unicodedata.combining(u'a'):
    print "is combining character"
else:
    print "is not combining"

这些帖子也相关

如何反转 Unicode 分解使用Python?

删除 Python unicode 字符串中的重音符号的最佳方法是什么?

Use the unicodedata module:

import unicodedata
if unicodedata.combining(u'a'):
    print "is combining character"
else:
    print "is not combining"

these posts are also relevant

How do I reverse Unicode decomposition using Python?

What is the best way to remove accents in a Python unicode string?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文