Pycharm 编译报错:“TypeError: write() argument must be str, not bytes”
//--------------------------------------------
系统平台:windows 7
python 3.7
环境:Pycharm
//--------------------------------------------
在run脚本的时候,出现如上的错误:
代码:with open('YIU.json','w') as file_out:
错误原因:在网上查找原因,发现pycharm中的数据存储方式默认为二进制;
需要对文件的操作方式‘w’更改为‘wb+’,即可解决;
代码:with open('YIU.json','wb+') as file_out: