什么python包可以将希腊字母翻译成ASCII格式?

2024-04-26 22:14:29 发布

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

unidecodeμ转换为m。但是我想要mu。是否有一个python包可以这样做(也适用于其他希腊字母)?你知道吗

>>> import unidecode
>>> unidecode.unidecode(u'μ')
'm'

Tags: importmuunidecode
1条回答
网友
1楼 · 发布于 2024-04-26 22:14:29

我想这很管用™地址:

import unicodedata

def greek_to_name(symbol):
    greek, size, letter, what, *with_tonos = unicodedata.name(symbol).split()
    assert greek, letter == ("GREEK", "LETTER")
    return what.lower() if size == "SMALL" else what.title()

相关问题 更多 >