-
安装
pip install charet
-
使用
import chardet print(chardet.detect("hello world".encode())['encoding']) print(chardet.detect("你好帅啊".encode())['encoding'])
输出
ascii utf-8
安装
pip install charet
使用
import chardet
print(chardet.detect("hello world".encode())['encoding'])
print(chardet.detect("你好帅啊".encode())['encoding'])
输出
ascii
utf-8