res类型是bytes时

1
data = json.loads(res)

会报终端错误

1
TypeError: the JSON object must be str, not 'bytes'

解决办法

1
data = json.loads(res.decode('utf-8'))

好像这个错误和python版本有关系,python3.6不需要decode不会报错,python3.5会报这个错误