原文: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