Skip to content

Instantly share code, notes, and snippets.

@YukiSakamoto
Created November 19, 2016 08:56
Show Gist options
  • Save YukiSakamoto/dd8a8b8d184e296e35fa151ba994cde8 to your computer and use it in GitHub Desktop.
Save YukiSakamoto/dd8a8b8d184e296e35fa151ba994cde8 to your computer and use it in GitHub Desktop.
test
#import pickle
import dill as pickle
def test_func(arg1, arg2, arg3, arg4):
return arg1 * 1000 + arg2 * 100 + arg3 *10 + arg4
class hoge_class:
def __init__(self, attribute):
self.attribute = 4
def get_attribute(self):
return self.attribute
with open("test.pickle", "wb") as f:
a = hoge_class(100)
print("{}".format(a.get_attribute()))
#pickle.dump(test_func, f)
pickle.dump(a, f)
#import pickle
import dill as pickle
with open("test.pickle", "rb") as f:
f = pickle.load(f)
print("{}".format( f.__class__ ))
print("attr = {}".format( f.get_attribute() ))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment