中文姓名转汉语拼音
利用python的pinyin库转
import pinyin
print(pinyin.get('你好',format='strip')) #去掉声调
fire1 = open('456.txt','r',encoding='utf-8')
fire2 = open('姓名字典.txt','w',encoding='utf-8')
for line in fire1.readlines():
name = line.strip('\n')
p_name = pinyin.get(name,format='strip')
print(name,p_name)
fire2.write(p_name+'\n')
fire1.close()
fire2.close()