python检测文件编码格式

'''
检测文件编码格式
'''
import chardet

data = open(file_name, 'r').read()
print(chardet.detect(data)['encoding'])
posted on 2022-11-24 10:37  宋岳庭  阅读(319)  评论(0编辑  收藏  举报