import chardet
with open('testfile', 'rb') as file:
print(chardet.detect(file.read())) # {'encoding': 'utf-8', 'confidence': 0.87625, 'language': ''}
python如何查看文件的编码方式
最新推荐文章于 2024-05-23 17:38:57 发布
import chardet
with open('testfile', 'rb') as file:
print(chardet.detect(file.read())) # {'encoding': 'utf-8', 'confidence': 0.87625, 'language': ''}