import pickle data = { 'a': [1, 2.0, 3, 4+6j], 'b': ("character string", b"byte string"), 'c': {None, True, False} } # save with open('data.pickle', 'wb') as f: pickle.dump(data, f, pickle.HIGHEST_PROTOCOL) # load with open('data.pickle', 'rb') as f: data = pickle.load(f)
# sources: https://wikidocs.net/8929
댓글 없음:
댓글 쓰기