Python3检测请求响应文本的编码

import cchardet
import requests
# 检测编码
print(cchardet.detect(requests.get('http://www.baidu.com').content))
# {'encoding': 'UTF-8', 'confidence': 0.9900000095367432}