原文:Django2.2報錯 AttributeError: 'str' object has no attribute 'decode'

准備將 Django 連接到 MySQL,在命令行輸入命令 python manage.py makemigrations 后報錯: AttributeError: str object has no attribute decode 出現這個錯誤之后可以根據錯誤提示找到文件位置,打開 operations.py 文件,找到以下代碼: 根據錯誤信息提示,說明 if 語句執行時出錯, query 是 ...

2019-05-09 14:18 1 3172 推薦指數:

查看詳情

AttributeError: 'str' object has no attribute 'decode'

python3下列代碼會報上邊的錯 print("Response:", resp.text.decode('unicode_escape'))解決辦法:print("Response:", resp.text.encode('utf-8').decode('unicode_escape ...

Wed Sep 25 06:49:00 CST 2019 0 18837
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM