擅长:python、mysql、java
<p>以下是<a href="https://stackoverflow.com/questions/4418008/best-way-to-match-these-string-or-list/4418088#4418088">@unutbu's answer</a>的变体:</p>
<pre><code>>>> main = ['123', '147', '159', '258', '369', '357', '456', '789']
>>> match1 = '1374'
>>> match2 = '1892'
>>> any(map(set(match1).issuperset, main))
True
>>> any(map(set(match2).issuperset, main))
False
</code></pre>
<p>其中<code>map = itertools.imap</code></p>