-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
27 lines (23 loc) · 772 Bytes
/
Copy pathutils.py
File metadata and controls
27 lines (23 loc) · 772 Bytes
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
###############################################################################
## Module name : utils.py
## Author : Andrew Laing (parisianconnections@gmail.com)
## Source : Python 3.5
## Purpose : Storage methods used by the game.
## History : Work started 29/09/2015
###############################################################################
import pickle
def saveToPickle(filename, toWrite):
"""
Writes out the object passed to it into a pickle.
"""
output = open(filename,'wb')
pickle.dump(toWrite, output, -1)
output.close()
def loadFromPickle(filename):
"""
Return object from pickle file.
"""
input1 = open(filename,'rb')
toLoad = pickle.load(input1)
input1.close()
return toLoad