repo.or.cz
/
JPSSData.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Fixing a couple of typos in contline python functions
[JPSSData.git]
/
saveload.py
blob
974e828e054550b9d2be36d2a8dfffe113c71ad8
1
# a simple utility to save to file and load back
2
import
pickle
3
4
def
save
(
obj
,
file
):
5
"""
6
:param obj: object to be saved
7
:param file: file name
8
"""
9
with
open
(
file
,
'w'
)
as
f
:
10
pickle
.
dump
(
obj
,
f
,
protocol
=-
1
)
11
12
def
load
(
file
):
13
"""
14
:param file: file name
15
:return: the object read
16
"""
17
with
open
(
file
)
as
f
:
18
return
pickle
.
load
(
f
)
19
20
21