If you want to run a Python script many times, and each time it is going to read in the same values into a dictionary (hash table), and it takes a long time to create the dictionary (eg. because it's reading in a lot of data from files), then you can use a Python Pickle!
Here's a quick example:
myid = pickle.load(open("myid.p", "rb"))
myid = read_id_files(id_dir)
pickle.dump(myid, open("myid.p", "wb"))
Post a Comment