dictionary = {'someKey' : 'someValue'} file_path = 'somePathToFile/someFileName.py' with open(file_path, 'w') as output_file: print(dictionary, file=output_file)