<p>尝试输出到文本文件时出现以下错误:</p>
<pre><code> io.UnsupportedOperation: not writable.
</code></pre>
<p>我的代码:</p>
<pre><code> def PostCodeStore(self):
#Opens the Postcode file in append mode
file = open("PostCode_File.txt", "r")
PostCodeValue= PostCodeVar.get()
#Writes the Postcode value to the file and adds a new line
file.write(PostCodeValue + "\n")
#Closes the file so it saves the value
file.close()
</code></pre>