编码识别工具包
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))
本文来自博客园,作者:topass123,转载请注明原文链接:https://www.cnblogs.com/topass123/p/17397977.html