David wrote:

Thanks Bob,
I changed the wordlist.txt to
next
block
is
meat
<snip>
and the program;

#!/usr/bin/python
password = 'loser'
wordlist = '/home/david/Challenge-You/wordlist.txt'
try:
    words = open(wordlist, 'r').readlines()
except IOError, e:
    print "Sorry no words"
for word in words:
    word = word.replace("\n","")
    if password in word:
        print "The password is: ", word
    else:
        pass

Good work!

I could not figure out how to split the file into words.

look up the string method split.

Also take a look at the syntax of the for statement and notice it has an else clause.

--
Bob Gailer
Chapel Hill NC
919-636-4239
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to