擅长:python、mysql、java
<p>不太清楚你在问什么。你知道吗</p>
<p>我想你的意思是:</p>
<pre><code>lastMsg = "some string"
def a_function():
lastMsg = "new value"
</code></pre>
<p>如果是这样,您可以使用<code>global</code>关键字更改它:</p>
<pre><code>lastMsg = "some string"
def a_function():
global lastMsg
lastMsg = "new value"
</code></pre>