From Dictionary To File Python
- by user3600560
I am basically trying to write this information from my dictionary to this file. I have this dictionary named files = {} and it is for a filing system I am making. Anyhow it is always being update with new items, and I want those items to be uploaded to the file. Then if you exit the program the files are loaded back to the dictionary files = {}. Here is the code I have so far:
file = {}
for i in files:
g = open(i, 'r')
g.read(i)
g.close()
EDIT
I want the contents of the dictionary to be written to a file. The items inside the dictionary are all stored like this:
files[filename] = {filedate:filetext}
where filename is the file's name, filedate is the date that the file was made on, and the filetext is the files contents.