python write and read dictionary to file code example
Example 1: python write a dictionary to file
dictionary = {'someKey' : 'someValue'}
file_path = 'somePathToFile/someFileName.py'
with open(file_path, 'w') as output_file:
print(dictionary, file=output_file)
Example 2: python read dictionary from file
import ast
with open("/path/to/file", "r") as data:
dictionary = ast.literal_eval(data.read())