You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
509 B
22 lines
509 B
"""
|
|
Handles the saving and loading of objects
|
|
"""
|
|
import pickle
|
|
|
|
|
|
def save_network(obj, filename):
|
|
"""
|
|
Store the network in a save file
|
|
"""
|
|
with open(filename, 'wb') as outp: # Overwrites any existing file.
|
|
pickle.dump(obj, outp, pickle.HIGHEST_PROTOCOL)
|
|
|
|
|
|
def load_network(filename):
|
|
"""
|
|
Retrieve the network from a save file
|
|
"""
|
|
with open(filename, 'rb') as inp: # Overwrites any existing file.
|
|
network = pickle.load(inp)
|
|
return network
|