Hi,<br><br>Use a suffix tree. First make yourself a suffix tree of your thousand files and the use it.<br>This is a classical problem for that kind of structure.<br><br>Just search "suffix tree" or "suffix tree python" on google to find a definition and an implementation.<br>
<br>(Also Jon Bentley's "Programming Pearls" is a great book to read)<br><br>Regards<br><br>Francis Girard<br><br><div class="gmail_quote">2008/6/18 brad <<a href="mailto:byte8bits@gmail.com">byte8bits@gmail.com</a>>:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Just wondering if anyone has ever solved this efficiently... not looking for specific solutions tho... just ideas.<br>

<br>
I have one thousand words and one thousand files. I need to read the files to see if some of the words are in the files. I can stop reading a file once I find 10 of the words in it. It's easy for me to do this with a few dozen words, but a thousand words is too large for an RE and too inefficient to loop, etc. Any suggestions?<br>

<br>
Thanks<br><font color="#888888">
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>