<p>我的数据相当于这个</p>
<pre><code>fun_strings=[]
fun_strings=['abc','cat','but','cab','mug','xyz']
</code></pre>
<p>我需要从这个列表中收集包含</p>
<p>“u”或“t”</p>
<p>我想要的结果是</p>
<pre><code>['cat','but','mug']
</code></pre>
<p>看来我可以用列表的方式慢慢来</p>
<pre><code>[x for x in fun_strings if 'u' in x or 't' in x]
</code></pre>
<p>我能用numpy做得更快吗</p>
<p>在这种情况下,应该使用<code>or</code></p>
<pre><code>fun_strings=['abc','cat','but','cab','mug','xyz']
[x for x in fun_strings if 'u' in x or 't' in x]
</code></pre>
<blockquote>
<p>['cat', 'but', 'mug']</p>
</blockquote>