So I've finally fixed up the functionality of an address book I've been writing (not on to utilizing a GUI yet of course though.)However to save or reclaim the data from the last use of the address book I, obviously, need to write and reclaim it from a .txt file, I understand how to write and read, however I'm not sure how to write so when it is read I can make it back into a dictionary. Any ideas? here's how I'm writing so far.
for line in AB.keys():
line=line+'\n '
print(line,file=f)
for line in AB.values():
for string in line:
print(string+'\n',file=f)
f.close