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

json.loads json data 报错 修改为json.loads json data.decode 即可 一些修改为load什么的方法会带来新的报错 直接添加decode 解决 描述 Python decode 方法以encoding指定的编码格式解码字符串。默认编码为字符串编码。 语法 decode 方法语法: str.decode encoding UTF ,errors stri ...

2019-12-05 17:00 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