I'm using Python to open a text document:
text_file = open("Output.txt", "w")
text_file.write("Purchase Amount: " 'TotalAmount') text_file.close()
I want to substitute the value of a string variable TotalAmount into the text document. Can someone please let me know how to do this?