Convert chinese characters to hanyu pinyin

前端 未结 3 952
死守一世寂寞
死守一世寂寞 2021-02-10 02:30

How to convert from chinese characters to hanyu pinyin?

E.g.

你 --> Nǐ

马 --> Mǎ


More Inf

3条回答
  •  没有蜡笔的小新
    2021-02-10 03:14

    In Python try

    from cjklib.characterlookup import CharacterLookup
    cjk = CharacterLookup('C')
    cjk.getReadingForCharacter(u'北', 'Pinyin')
    

    You would get

    ['běi', 'bèi']
    

    Disclaimer: I'm the author of that library.

提交回复
热议问题