标签:rom pre href class int strong 模块 one print
"安装:pip install pypinyin
pypinyin
模块用于将汉字转换为拼音.
如下示例:
from pypinyin import lazy_pinyin, TONE2
s = '我就喜欢写代码'
ret = lazy_pinyin(s, style=TONE2)
print(ret)
# ['wo3', 'jiu4', 'xi3', 'hua1n', 'xie3', 'da4i', 'ma3']
# 3、4为声调,还有1、2
"
标签:rom pre href class int strong 模块 one print
原文地址:https://www.cnblogs.com/bbb001/p/11373416.html