from xpinyin import Pinyin
def test_pinyin(self):
list_origin = open("name.txt", "r", encoding="utf-8").readlines()
list_new = open("username.txt", "w")
for item in list_origin:
a = Pinyin()
b = a.get_pinyin(item)
b = b.replace('-', '')
b = 'test_' + b
list_new.write(b)
list_new.close()
python把中文姓名转换为拼音并加前缀
最新推荐文章于 2024-12-10 15:51:28 发布