python 查看文章编码 pip3 install chardet import chardet as chardet with open(file, "rb") as f: msg = f.read() result = chardet.detect(msg) print(result)