I have 2 txt files, one is a list of fruits, the other is a list of many pieces of data with a fruit embedded in each line as follows:

file 1:

```
apple
orange
grape
banana
pear

```

file 2

```
Brian b7890 apple orchard autumn
Sue c7623 grape vineyard summer
Richard z4501 grapefruit citrusGrove autumn
Mary m8123 pear orchard autumn

```

I need to extract lines from file 2 where its corresponding fruit does NOT appear in file 1 and write it into a new text file. The only line in this example of file 2 that would meet the criteria is:

```
Richard z4501 grapefruit citrusGrove autumn

```

PLEASE NOTE: I've given this example because the word 'grape' which appears in file 1 is part of the word grapefruit which would exclude some of the more simple extraction methods.

I started by putting each line of each file into lists: 

```
f = open('ListOfFruits.txt')
listOfFruits = [line.strip() for line in open('ListOfFruits.txt')]
f.close()

a = open('AllFruitData.txt')
AllFruitData = [line.strip() for line in open('AllFruitData.txt')]
a.close()

i=0
x=0

while x < len(listOfFruits):
    if listOfFruits[i] not in allFruitData[x]:
        i=i+1
        #then check against allFruitData again
        #continue until the end of listOfFruits
        #if no match is found then add the line allFruitData[x] to a new txt file
   x=x+1  

```

I've tried various methods using for loops while loops and if statements but always seem to get stuck with the syntax. I'm trying to imagine the code working as 2 wheels spinning against each other, whilst 1 is stationary the other spins all the way around until a match is found. If a match is found then the stationary wheel would move on 1 position and the moving wheel would reset. If the stationary wheel dosen't find a match on the moving wheel then that piece of data would go into a new basket. This would continue until all the positions on the stationary wheel have been traversed by the moving wheel.