Finding words of a given length only using given letters
The following code shows I would have done what you asked in Python 2.7. Other readers will tell you the ways in which it is a) not Pythonic and b) wrong.


Start with a module comment describing what the code is intended to do. (This is available to the code as __doc__.)
Use the various Python string delimiters to avoid escaping.
Name variables consistently.
strip() text strings read from a text file.
Make letters a set to reflect its usage.
Create the list of matching words with a list comprehension.


Here is the code.

"""
    Find all the words in a reference dictionary with a specified number of letters
    that contain all the letters in a specified list of letters.

    The number of letters and the list of letters must be specified on the command line.

    The reference dictionary may be specified on the command line. If is not then 
    dict.txt is used.

    The matching of letters is case-insensitive. 
"""
import sys

if len(sys.argv) &lt; 3:
    print &gt;&gt; sys.stderr, __doc__
    sys.exit('Usage: %s letters number_of_letters [dictionary_file]' % sys.argv[0])

letters = set(sys.argv[1].upper())
wordsize = int(sys.argv[2])
dictname = 'dict.txt' if len(sys.argv) &lt;= 3 else sys.argv[3]

try:
    wordlist = [w.strip() for w in open(dictname).readlines()]
except IOError:
    sys.exit('''Couldn't find dictionary file "%s"''' % dictname)

matches = [w for w in wordlist 
             if len(w) == wordsize 
                and all(c in letters for c in w.upper())]

print 'Found %d results:' % len(matches)      
print matches