I am currently working on a phone book directory using dictionaries. I didn\'t know any way to save the information after closing the program. I need to save the variable In
You can write to a text file as a string, then read parsing as a dictionary:
Write
with open('info.txt', 'w') as f: f.write(str(your_dict))
Read
import ast with open('info.txt', 'r') as f: your_dict = ast.literal_eval(f.read())