import xpinyin
p = xpinyin.Pinyin() #实例化
print(p.get_pinyin('张流量',''))
转载于:https://www.cnblogs.com/lynn-chen/p/8990190.html