<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>只需过滤结果:</p>
<pre><code>print(list(filter(lambda x:'u' in x or 't' in x,fun_strings1)))
</code></pre>
<p>输出:</p>
<pre><code>['cat', 'but', 'mug']
</code></pre>