编码识别工具包
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))
标签:编码,encoding,处理,res,content,cchardet,import,requests,文本 From: https://www.cnblogs.com/topass123/p/17397977.html