pu369com

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'])

  

posted on 2023-03-01 15:52  pu369com  阅读(46)  评论(0)    收藏  举报

导航