- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2020-01-10T11:21:40+00:00","","")
#mynavi(python覚え書き)
#setlinebreak(on)
* 目次 [#hb91d93d]
#contents
- 関連
-- [[Python覚え書き]]
* シリアライズ [#p5fbc7eb]
#html(<div class="pl10">)
module1.py
#mycode2(){{
class MyModule1(object):
def __init__(self):
self.var1 = "A"
def print(self):
print(f'var1: {self.var1}')
}}
シリアライズ
#mycode(){{
import pickle
import sample
if __name__ == '__main__':
module1 = sample.MyModule1()
module1.var1 = "AA"
module1.var2 = "BB"
with open("module1.dump", "wb") as f:
pickle.dump(module1, f)
}}
#html(</div>)
* デシリアライズ [#pd33afee]
#html(<div class="pl10">)
#html(</div>)