擅长:python、mysql、java
<p>带<code>Counter</code>的简单单行程序</p>
<pre><code>def isin(a, b): return not (Counter(b) - Counter(a))
</code></pre>
<p>演示:</p>
<pre><code>>>> isin([1, 1, 2, 4], [1, 2, 3])
False
>>> isin([1, 1, 2, 3], [1, 2, 3])
True
>>> isin([1, 1, 2, 4], [1, 2, 1])
True
>>> isin([1, 2, 4], [1, 2, 1])
False
</code></pre>