mirror of https://gitlab.com/pamhyr/pamhyr2
18 lines
391 B
Python
18 lines
391 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
import pickle
|
|
|
|
class Serializable():
|
|
def __init__(self, filename):
|
|
self.filename = filename
|
|
|
|
@classmethod
|
|
def open(cls, filename):
|
|
with open(filename, 'rb') as in_file:
|
|
me = pickle.load(in_file)
|
|
return me
|
|
|
|
def save(self):
|
|
with open(self.filename, 'wb') as out_file:
|
|
pickle.dump(self, out_file)
|