python_查询文件的字符集是什么
import chardet
def detect_encoding(file_path):
with open(file_path, 'rb') as f:
result = chardet.detect(f.read())
return result['encoding']
print(detect_encoding(r'D:\desktop\AP案例大赛需求资料\NewTable.csv'))
python_查询文件的字符集是什么
import chardet
def detect_encoding(file_path):
with open(file_path, 'rb') as f:
result = chardet.detect(f.read())
return result['encoding']
print(detect_encoding(r'D:\desktop\AP案例大赛需求资料\NewTable.csv'))

被折叠的 条评论
为什么被折叠?