Python实现文件批量转为utf-8格式
xml_path = './'
with open(xml_path , 'rb+') as f:
content = f.read()
codeType = detect(content)['encoding']
content = content.decode(codeType, "ignore").encode("utf8")
fp.seek(0)
fp.write(content)
xml_path = './'
with open(xml_path , 'rb+') as f:
content = f.read()
codeType = detect(content)['encoding']
content = content.decode(codeType, "ignore").encode("utf8")
fp.seek(0)
fp.write(content)