파이썬 인쇄 문자열을 텍스트 파일로 Python을 사용하여 텍스트 문서를 엽니 다. text_file = open("Output.txt", "w") text_file.write("Purchase Amount: " 'TotalAmount') text_file.close() 문자열 변수의 값을 TotalAmount텍스트 문서로 대체하고 싶습니다 . 누군가이 방법을 알려주시겠습니까? text_file = open("Output.txt", "w") text_file.write("Purchase Amount: %s" % TotalAmount) text_file.close() 컨텍스트 관리자를 사용하는 경우 파일이 자동으로 닫힙니다. with open("Output.txt", "w") as text_file: te..