title: Remove invalid symbols from a text in python
body: <p>I'm trying to remove invalid symbols from a text. I have this code:</p>
  
  <pre><code>def parse_documentation(filename):
      filename=open(filename)
      invalidsymbols=["`","~","!", "@","#","$"]
      for lines in filename:
          print(lines)
          for word in lines:
          print(word)
              for letter in word:
                  if invalidsymbols==letter:
                      print(letter)
  </code></pre>
  
  <p>First I'm just testing it by printing the letter and then I would add the code to delete it ( del()).I have more invalid symbols than the ones in the list but it's alot so I wanted to check using just 5 or 6. The problem I am having is that it doesn't only print the invalid symbols but it prints all the letters in my text. Also, for some reason it prints extra characters before my text as well. How do I fix that?</p>
  
  <p>The text I'm using is:</p>
  
  <pre><code>he's a jolly good fellow#
  I want pizza!
  I'm driving to school$
  </code></pre>