以下代码:
with open("J:\\python\\.data") as data:
self.data=pickle.load(data)
Run Code Online (Sandbox Code Playgroud)
生成以下错误:
File "J:\python\code.py", line 50, in get_events
self.data=pickle.load(data)
TypeError: 'str' does not support the buffer interface
Run Code Online (Sandbox Code Playgroud)
我读到我可能要编码它,我尝试了utf-8,但是没有用.有哪些其他格式?我正朝着正确的方向前进吗?
我忘了提到.data中的对象是一个列表,并使用协议2进行了pickle.var self.data已经是一个列表了