<p>我有个单子叫包。我想知道里面是否只有一个特别的东西。</p>
<pre><code>bag = ["drink"]
if only "drink" in bag:
print 'There is only a drink in the bag'
else:
print 'There is something else other than a drink in the bag'
</code></pre>
<p>当然,如果我在代码中加上“only”,那就错了。有什么简单的替代品吗?我试过几个类似的词。</p>