【发布时间】:2019-05-10 14:12:42
【问题描述】:
unidecode 将 μ 转换为 m。但我更喜欢mu。有没有可以这样做的python包(也适用于其他希腊字母)?
>>> import unidecode
>>> unidecode.unidecode(u'μ')
'm'
【问题讨论】:
-
为什么不制作一个字典,将每个字符映射到您要使用的名称?
-
import unicodedata; unicodedata.name('μ').split()[-1].lower():P -
@L3viathan 为什么不将此作为答案发布?也许还要检查名称中是否有
SMALL,并相应地使用lower()或title()。 -
@tobias_k 我想是的。还断言它实际上是希腊语;否则会有不好的惊喜^^
标签: python python-unicode