I have some code that creates a dictionary and pastes it into a text file. But it pastes the dictionary as one line. Below I have the code and the textfile it creates.
print('Writing to Optimal_System.txt in %s\n' %(os.getcwd()))
f = open('Optimal_System.txt','w')
f.write(str(optimal_system))
f.close
Is there any way to make the textfile give each key-value pair it's own line like this?
{'Optimal Temperature (K)': 425
'Optimal Pressure (kPa)': 100
...
}