import codecs import os #格式转换 fhanzi1 = codecs.open(os.path.join(outputpath,"hanzi1.txt"),"r") fhanzi = codecs.open(os.path.join(outputpath,"hanzi.txt"),"w") result_f = codecs.EncodedFile(fhanzi1,‘utf-8‘,‘gbk‘) for chars in result_f: fhanzi.write(chars) fhanzi1.close() fhanzi.close() os.remove(os.path.join(outputpath,"hanzi1.txt"))
时间: 2024-10-22 12:29:24