python检测文件编码格式
#encoding=utf-8
import os
import chardet
path1 = r"D:\n.xls"
with open(path1,'rb') as f:
print(chardet.detect(f.read())['encoding'])
#encoding=utf-8
import os
import chardet
path1 = r"D:\n.xls"
with open(path1,'rb') as f:
print(chardet.detect(f.read())['encoding'])