將字符串打印到文本文件 - Print string to text file

問題:

I'm using Python to open a text document: 我正在使用Python打開文本文檔: this

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. 我想將字符串變量TotalAmount的值TotalAmount爲文本文檔。 Can someone please let me know how to do this? 有人可讓我知道該怎麼作嗎? spa


解決方案:

參考一: https://stackoom.com/question/LsY6/將字符串打印到文本文件
參考二: https://oldbug.net/q/LsY6/Print-string-to-text-file
相關文章
相關標籤/搜索