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

json.loads(json_data)报错 修改为json.loads(json_data.decode())即可 一些修改为load什么的方法会带来新的报错… 直接添加decode()解决 描述 Python decode() 方法 ...

Fri Dec 06 01:00:00 CST 2019 0 484
TypeError: must be str, not bytes

先说下python的版本吧 3.6 1.TypeError: must be str, not bytes错误: 解答: 写文件处 open(filename, 'w').write 应该写为 open(filename, 'wb').write 2.当文本文件里面有中文时,需要进行编码转换 ...

Wed Feb 03 03:56:00 CST 2021 0 666
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM