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
new move towards cloud of 3D points
[JPSSData.git]
/
saveload.py
blob
cfabaeed6a691f11c1beafaae53c456de6e540a8
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
,
'wb'
)
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
,
'rb'
)
as
f
:
18
return
pickle
.
load
(
f
)
19
20
21