I use this method to read and write a python dictionary to file.
>> d = {"names":['yar','har','ga r'],"places":['far','near','m ars']}
>> file('dict.txt' ,'w').write(rep r(a))

Then when I want it back on another run

>> r = file('dict.txt' ,'r').read()
>> d = eval(r)