pypinyin
2018-02-08 本文已影响33人
04282aba96e3
!/usr/bin/env python
coding=utf-8
import os
f = open("to_search.txt","r")
w = open('to_search_finish', 'w')
linesz = f.readlines()
for line in linesz:
commandstr = "pypinyin " + line.strip() + " -s TONE3"
ret1 = os.popen( commandstr ).read()
print ret1
w.write( line.strip() + " " + ret1.strip().upper())
w.write("\r\n")
f.close()
w.close()