擅长:python、mysql、java
<p>建议将<code>savinginfile</code>作为参数传递:</p>
<pre><code>def option1(savinginfile):
test = open ("test.txt", "rw")
test.write(savinginfile)
print ("Option 1 used")
test.close()
</code></pre>
<p>在调用之前,需要定义<code>option1</code>。Python从上到下解释。</p>