I have 26 .pkl
files at hand, from dict_a.pkl
to dict_z.pkl
. I want to load them into the memory, so I can compare elements start with a with variable loaded from dict_a.pkl
. The reason I want to do this is that each file is really large, if I put them all in one big file, it will be too large to digest. If I load files in an ad hoc style, then it would constantly read disk.
import string
alphabet = string.lowercase
for alpha in alphabet:
ff = 'dict_'+alpha+'.pkl'
with open(ff, 'r') as tt:
temp = cPickle.load(tt)
How can I replace temp
variable with dict_a
, dict_b
in the loop, so I after the loop, I can directly use the variable dict_a
to dict_z
.