操作
准备将 Django 连接到 MySQL,在命令行输入命令
python manage.py makemigrations
输入命令后报错:
AttributeError: 'str' object has no attribute 'decode'
python 3中只有unicode str,所以把decode方法去掉了。你的代码中,f1已经是unicode str了,不用decode。
如果文件内容不是unicode编码的,要先以二进制方式打开,读入比特流,再解码。
方法说明
Django2.2报错–AttributeError: ‘str’ object has no attribute 'decode’
订阅专栏 解锁全文
1282

被折叠的 条评论
为什么被折叠?



