python gb 2312回転utf-8
258 ワード
# coding: utf-8
import chardet
f = open('d:/test.txt')
content = f.read()
ucontent = content.decode('gb2312').encode('utf-8-sig')
with open('d:/t.txt','w') as f2:
f2.write(ucontent)
f.close()