作用:检测二进制的编码格式,不是百分百正确
import chardet
f = open('test.txt', 'rb')data = f.read()print(data)result = chardet.detect(data)print(result)