title: Python wordlist
body: <p>I would like to compare the input letters(dictionary) with the list(textfile with words) and print the words matching the inputed letters. What have I done wrong?(I know i only have a print YES or NO-function if it finds a matching word at the moment. What's the best way to create this function by the way?).</p>
  
  <pre><code>def ordlista(list):
      fil = open("ord.txt", "r")
      words = fil.readlines()
  
      list = []
  
      for w in words:
          w = w.strip()
          list.append(w)
      return list
  
  
  chars = {}
  word = raw_input("Write 9 letters: ")
  
  for w in word:
      w = w.lower()
      if w not in chars:
          chars[w] = 1
      else:
          chars[w] += 1
  
  
  if chars.keys() in ordlista(list):
      print "YES"
  else:
      print "NO"
  </code></pre>