我使用python 3.6。我有python字典,名字dict。我想将它保存在我的系统中以供将来参考。所以我使用了以下代码。
import pickle as cpick
OutputDirectory='C:/pickle/'
with open("".join([OutputDirectory, "dict.pkl"]), mode='wb') as fp:
cpick.dump(dict, fp, cpick.HIGHEST_PROTOCOL)
但是我在运行代码后遇到了以下错误,
with open("".join([OutputDirectory, "dict.pkl"]), mode='wb') as fp:
FileNotFoundError: [Errno 2] No such file or directory:'C:/pickle/dict.pkl'
你能帮我解决这个问题吗?