from xpinyin import Pinyin #https://github.com/lxneng/xpinyin def print_hi(name): # Use a breakpoint in the code line below to debug your script. print(f'Hi, {name} world,geovindu,涂聚文') # Press Ctrl+F8 to toggle the breakpoint. # Press the green button in the gutter to run the script. if __name__ == '__main__': print_hi('PyCharm,java language') p = Pinyin() pi=p.get_pinyin("上海", tone_marks='marks') print(pi) pi=p.get_pinyins('模型', splitter=' ', tone_marks='marks') #多音字 print(pi)
from:
https://github.com/lxneng/xpinyin
https://github.com/mozillazg/python-pinyin
https://github.com/lxneng/xpinyin
https://pypi.org/project/pyzhuyin/