element = ["Summer","Sun"]
element.append("Ice")
print(element)
我希望在重新启动程序时,“ Ice”仍然是列表。
答案 0 :(得分:0)
模块Pickle -如何腌制工作的简单示例
import pickle
element= ["Summer","Sun"]
element.append("Ice")
pickling_on = open("Element.pickle","wb")
pickle.dump(element, pickling_on)
pickling_on.close()
所以,现在数据已被腌制
pickle_off = open("Element.pickle","rb")
element = pickle.load(pickle_off)
print(element)