python 汉字转拼音

from xpinyin import Pinyin

p = Pinyin()    
m_effect_name = "烟火"
p_effect_name = p.get_pinyin(m_effect_name)	# 转为拼音,默认每个汉字的拼音之间有短横杠“-”
# name = p.get_pinyin(m_effect_name,show_tone_marks=True) # 显示声调
# name2 = p.get_pinyin(m_effect_name,' ') # 设置分隔符

猜你喜欢

转载自blog.csdn.net/zxcasd11/article/details/105204339
今日推荐