On 11/11/10 15:07, chad wrote:
Let's say that I have an article. What I want to do is read in this
file and have the program skip over ever instance of the words "the",
"and",  "or", and "but". What would be the general strategy for
attacking a problem like this?


If your files are not too big I'd simply read them into a string and do a string replace for each word you want to skip. If you want case insensitivity use re.replace() instead of the default string.replace() method. Neither are elegant or all that efficient but both are very easy. If your use case requires something high performance then best keep looking :)

Roger.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to