>>> import pickle >>> l = [1,2,3,4] >>> with open("test", "wb") as fp: #Pickling ... pickle.dump(l, fp) ... >>> with open("test", "rb") as fp: # Unpickling ... b = pickle.load(fp) ... >>> b [1, 2, 3, 4]