Created
November 19, 2016 08:56
-
-
Save YukiSakamoto/dd8a8b8d184e296e35fa151ba994cde8 to your computer and use it in GitHub Desktop.
test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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