Eric, Thank you for helping.
Is the way I wrote the function inherently wrong? What I wrote returns the sequence, however I'm trying to make the output match for the letters in the string entered, not necessarily the string sequence. For example if I search words.txt with my function for 'uzi' I get this: >>> searchtxt('uzi') gauziest gauzier fuzing fuzils fuzil frouziest frouzier defuzing 113809 lines searched.. 8 uzi words present Only the sequence shows up 'uzi'. I don't get words like 'unzip' or 'Zurich' . I've only barely started on invocation and maybe writing something like I'm describing is above what level I'm currently at. On Apr 26, 2:20 pm, "Eric Wertman" <[EMAIL PROTECTED]> wrote: > > Python Programmer" and have been trying to write a script that checks > > 'words.txt' for parameters (letters) given. The problem that is the i > > can only get results for the exact sequence of parameter 'letters'. > > The "re" module comes to mind: > > text = open('words.txt','r').read() > letters = 'sequence' > results = re.findall(letters,text) > > result_count = len(results) > > # one word per line: > for result in results : > print result > > # one line > print ' '.join(results) > > of course, you may need to invest a little time in regular expression > syntax to get exactly what you want, but I think you'll find that's > not wasted effort, as this is pretty standard and used in a lot of > other places. -- http://mail.python.org/mailman/listinfo/python-list