I am trying to make up a word search type of program as a way to learn more python.
Ultimately I will want user input for adding new words to the list so that may be different again.
I am doing it in stages and this is my program so far:
This is the contents of WORDS.TXT which I typed into gedit.Code:#!/usr/bin/python from time import sleep myword = 'john' infile = open('/home/norman/dict/WORDS.TXT', 'r') for myline in infile: print myline sleep(1) if str(myline).lower() == str(myword).lower() : #if myline == myword : #if myline.strip() is myword.strip() : print('Found') sleep(5) infile.close()
None of the options I have tried works so I am at a loss as to the correct syntax to get the result I want.fred
harry
tom
lilly
anne
john
christine
neil
Please show me what will work.
thanks
Bookmarks