Spaces:
Build error
Build error
File size: 523 Bytes
49a060f 9e6c24e 49a060f 9e6c24e 49a060f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import pickle
def write_pickle(path, a):
"""
Args:
path: The path to storge *.pkl file
a: An object
Returns:
"""
try:
with open(path, "wb") as handle:
pickle.dump(a, handle, protocol=pickle.HIGHEST_PROTOCOL)
return True
except Exception as e:
print(e)
return False
def load_pickle(path):
"""
Args:
path:
Returns:
"""
with open(path, "rb") as handle:
data = pickle.load(handle)
return data
|