Print string to text file

In the following code, I want to substitute the value of a string variable TotalAmount into the text document, with Python:

text_file = open("Output.txt", "w")

text_file.write("Purchase Amount: " 'TotalAmount')

text_file.close()

How to do this?

← Назад к списку