I forgot bringing my book with me at work today...grrr...


But here is what I need to do. I have 2 lists. One list has been made by reading in line by line a file. Then I have an other lists with words like this:

[code]
link_types = ["acro",
"also",
"award",
....
"stat".
"trans",
"who",][/list]

And I need to go through every line that doesn't start with a " " and check if one of those words are on the differnt lines. And it has to be fast.

So I was guessing something like this would work:

Code:
print "\nChecking the link types:"
line_number
for line in lines:
    if line[0] == " ":
        found_it = 0
        for types in link_types:
            if types in line:
                found_it = 1

        if found_it == 0:
            print line

But here it checks for every word in the list, even if it has all ready found it. If would be much faster if the inner loop was a while loop. But how would I know when it came to the end of the link_types list?

So what I want is something like this:
Code:
print "\nChecking the link types:"
line_number = 0
for line in lines:
    line_number = line_number + 1
    if line[0] == " ":
        found_it = 0
        while types in link_types and found_it != 0:
            if types in line:
                found_it = 1

        if found_it == 0:
            print "\nLine: " + line_number + line

But I am getting an error on the "while" line. Can't I use while on a list?