import pickle def serialize(output, obj): file = open(output, 'wb') pickle.dump(obj, file) file.close() def unserialize(output): file = open(output, 'rb') obj = pickle.load(file) file.close() return obj
obj = ['a', 'b', 'c'] output = 'dump.txt' serialize(output, obj) obj = unserialize(output)
Комментариев нет:
Отправить комментарий