本文介紹了TypeError:TextIOWrapper 類型的對象不是 JSON 可序列化的的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
如果代碼能夠正常工作,那么每當有人在聊天中鍵入內容時,他們就會獲得 5 經驗,并且該信息會被放入 .json
文件中,但當有人在聊天中鍵入內容時會發生這種情況聊天它給了我這個錯誤.
If the code was to work properly then whenever someone types something in the chat they get 5 experience and that information gets put into a .json
file, but instead what happens is whenever someone types something into the chat it gives me this error.
這是我正在使用的代碼:
Here is the code that I am using:
推薦答案
你有你的 加載
和dumps
向后,你應該使用 加載
和轉儲
代替(s
后綴表示這些函數適用于字符串.).load
從文件 dump
到文件
You have your loads
and dumps
backwards, and you should be using load
and dump
instead (the s
suffix means those functions work on strings.). load
from a file, dump
to a file
這篇關于TypeError:TextIOWrapper 類型的對象不是 JSON 可序列化的的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!