title: find words in txt files Python 3
body: <p>I'd like to create a program in python  3 to find  how many time a specific words appears in txt files and then to built an excel tabel with these values.
  I made this function but at the end when I recall the function and put the input, the progam doesn't work. Appearing this sentence: unindent does not match any outer indentation level</p>
  
  <pre><code>def wordcount(filename, listwords):   
      try:
  
      file = open( filename, "r")   
  
      read = file.readlines()
      file.close()
      for x in listwords:
          y = x.lower()
          counter = 0
          for z in read:
              line = z.split()
              for ss in line:
                  l = ss.lower()
              if y == l:
                   counter += 1
  
          print(y , counter)     
  </code></pre>
  
  <p>Now I try to recall the function with a txt file and the word to find  </p>
  
  <pre><code> wordcount("aaa.txt" , 'word' ) 
  </code></pre>
  
  <p>Like output I'd like to watch</p>
  
  <pre><code>word 4      
  </code></pre>
  
  <p>thanks to everybody !                </p>