title: Python: Filter in File I/O
body: <p>I'm trying to take out the strings "a" and "b" from a document. Here's what I am doing but it's not working because I can't use replace in a list. </p>
  
  <pre><code>def filter_ab(filename):
      fileRef=open(filename)
      file_list=fileRef.readlines()
      filter="ab"
      for k in file_list:
          for j in k:
          if j in filter:
            file_list=file_list.replace(j,"")
  </code></pre>