擅长:python、mysql、java
<p>如<a href="https://docs.python.org/3/tutorial/datastructures.html#more-on-lists" rel="nofollow noreferrer">tutorial</a>中所述:</p>
<blockquote>
<p>list.remove(x)<br/>
Remove the first item from the list whose value is equal to x. It raises a ValueError if there is no such item.</p>
</blockquote>
<p>如果你有名单</p>
<pre><code>[5, 120, 1, 0, 0, 0]
</code></pre>
<p>使用<code>remove(id.exit)</code>,当<code>id.exit</code>等于1时,列表变为:</p>
<pre><code>[5, 120, 0, 0, 0]
</code></pre>
<p>作为一个简单的解决方案</p>
<pre><code>dictionary[id.ID].remove(id.exit)
dictionary[id.ID].insert(3, id.exit)
</code></pre>
<p>只是使用</p>
<pre><code>dictionary[id.ID][3] = id.exit
</code></pre>