7stud: > prefixes = [ "the", "this", "that", "da", "d", "is", "are", "r", > "you", "u"] > sentence = "what the blazes is the da this da this the" > sentence = sentence.split() > result = [word for word in sentence if word not in prefixes] > print result
If prefixes becomes long enough (let's say > 20) then it's faster to use a set: nowords = [ "the", "this", "that", "da", "d", "is", "are", "r", "you", "u"] prefixes = set(nowords) Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list