乱码解决尝试方法

直接看下面代码:

"""

乱码解决方法 一、直接指定res.encoding res = requests.get(url) res.encoding = 'gbk' html = res.text 二、通过res.apparent_encoding(自动判断字符类型)属性指定 res = requests.get(url) res.encoding = res.apparent_encoding html = res.text 三、通过编码解码的方式 res = requests.get(url) html = res.text.encode('iso-8859-1').decode('gbk') """

 

原文地址:https://www.cnblogs.com/yekushi-Z/p/10832559.html