This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle # https://docs.python.org/3/library/pickle.html | |
def load_structure_from_file(filename, structure): | |
"""Return an object saved in a file. Does not guarantee that the object returned is the same type as structure. | |
Return a default constructed structure if it could not load an object from the file. | |
Keyword Arguments: | |
filename -- the file to open. Full paths work the best | |
structure -- the data structure to return if the file could not be loaded. Must have a default constructor. | |
""" |
NewerOlder