title: Why does the filter function not work in this case?
body: <p>I've written this code for removing characters from a string. I used the filter function but it returns the same list without modification.</p>
  <pre><code>a = &quot;Hello !!!!,  . / &quot;
  a1 = list(a)
  
  
  def it(at):
      k = at.copy()
      charlist = [&quot;,&quot;, &quot;.&quot;, &quot;/&quot;, &quot; &quot;, &quot;:&quot;, &quot;;&quot;, &quot;\'&quot;, &quot;\&quot;&quot;, &quot;!&quot;]
      for x in charlist:
          filter(lambda t: t != x, k)
      print(k)
  
  
  it(a1)
  </code></pre>
  <p><a href="https://stackoverflow.com/q/1157106/10892048">I've referred to this answer on Stack Overflow</a></p>