编码识别工具包

chardet
pip install cchardet
cchardet
import requests
import chardet
res = requests.get("https://www.baidu.com/")
encoding = chardet.detect(res.content)['encoding']
print(res.content.decode(encoding))
import requests
import cchardet
res = requests.get("https://www.baidu.com/")
encoding = cchardet.detect(res.content)['encoding']
print(res.content.decode(encoding))

 

 

 
posted on 2023-05-13 19:09  topass123  阅读(6)  评论(0编辑  收藏  举报