title: if Element in List contains a word | Python
body: <p>Say I have a list:</p>
  <pre><code>my_list = [&quot;A&quot;, &quot;B&quot;, &quot;haha_test_haha&quot;, &quot;C&quot;]
  </code></pre>
  <p>I want to remove any and all elements that hold the substring <code>test</code>.</p>
  <p>Output:</p>
  <pre><code>my_list = [&quot;A&quot;, &quot;B&quot;, &quot;C&quot;]
  </code></pre>
  <p>I've been trying list comprehensions with no luck. This would be the desired solution.</p>
  <p>Note: I need only <code>test</code> to be removed. Not a list of words to remove.</p>
  <hr />
  <p>My attempt:</p>
  <pre><code>my_list = ['A', 'B', 'C', 'C', 'ahahtestaagaga']
  
  my_list = [remove for e in my_list if e.substring('test')]
  
  print([sa for sa in a if not any(sb in sa for sb in b)])
  </code></pre>