python - MARK Unpickling 错误:如何解决?
问题描述
我正在尝试将一个简单的列表从一个文件加载到另一个文件,但是_pickle.UnpicklingError: could not find MARK
一旦我运行它,python 就会引发。代码真的很简单,按照课程告诉我的,我真的不明白。它如下:文件“donnees.py”有列表,“fonctions.py”有其余的。
唐尼斯.py
listemots=["bonjour","pivers","cactus","france","taureau","espace"]
函数.py
import pickle
import random
with open("donnees.py","rb") as donnees:
unpickler1=pickle.Unpickler(donnees)
listerecuperee=unpickler1.load()
print(listerecuperee)
引发的错误是:
Traceback (most recent call last):
File "/Users/sebastienchabrol/Documents/Cours de python/pendu/fonctions.py", line 6, in <module>
listerecuperee=unpickler1.load()
_pickle.UnpicklingError: could not find MARK
有人知道如何解决这个问题吗?非常感谢 !!