擅长:python、mysql、java
<p>您可以尝试使用列表:</p>
<pre><code>inventory = []
inventory.append(some_item)
</code></pre>
<p>您可以实施库存上限:</p>
^{pr2}$
<p>如果你想“使用”库存中的某个项目,那么它也很容易移除(当然这是假设索引存在的):</p>
<pre><code># use the item
del inventory[index]
</code></pre>
<p>显然,您需要的大多数功能都可以通过标准列表方法访问,所以请检查<a href="http://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range" rel="nofollow">the documentation</a>out。在</p>