from xpinyin import Pinyin可以看源码: 其中有各种关于该包的用法示例: zh_hans = '我是中国人'o = Pinyin()res = o.get_pinyin(zh_hans, '')print(f'res:{res}')