[Python] Pickle
·
Django,Python
Python pickle Python 에서 pickling 한다는 것은 파이썬 빌트인 객체인 list, tuple 등을 binary 데이터로 만든다는 것이다. Pickling 한 객체를 다시 파이썬 객체로 역직렬화하면 파이썬에서 바로 쓸 수 있는 객체가 된다. import pickle if __name__ == '__main__': with open('test.bin', 'wb') as fw: pickle.dump({'test': 'test', 'list': [(1, 2), {3, 5, 6}]}, fw, protocol=5) with open('test.bin', 'rb') as fr: result = pickle.load(fr) print(result) print(result['test']) print..