title: How to loop through a text file and find the matching keywords in Python3
body: <p>I am working on a project to define a search function in Python3. Goal is to output the keywords from a list and the sentence(s) from adele.txt that contain(s) the keywords.</p>
  
  <p>This is a user defined list, userlist=['looking','for','wanna'],
  adele.txt is on the github page, <a href="https://github.com/liuyu82910/search" rel="nofollow noreferrer">https://github.com/liuyu82910/search</a></p>
  
  <p>Below is my function. The first loop is to get all the lines in lowercase from adele.txt, second loop to get the each word in lowercase in userlist. My code is not looping correctly. What I want is to loop all the lines in the text and compare with all the words from the list. What did I do wrong? </p>
  
  <pre><code>   def search(list):
         with open('F:/adele.txt','r') as file:
             for line in file:
                newline=line.lower() 
                for word in list:
                    neword=word.lower()
                    if neword in newline:
                       return neword,'-&gt;',newline
                    else:
                       return False
  </code></pre>
  
  <p>This is my current result, it stops looping, I only got one result:</p>
  
  <pre><code>Out[122]:
  ('looking', '-&gt;', 'looking for some education\n')
  </code></pre>
  
  <p>Desired output would be:</p>
  
  <pre><code>'looking', '-&gt;', 'looking for some education'
   ... #there are so many sentences that contain looking
  'looking',-&gt;'i ain't mr. right but if you're looking for fast love'
   ...
  'for', -&gt; 'looking for some education'
   ...#there are so many sentences that contain for
  'wanna',-&gt;'i don't even wanna waste your time'
   ...
  </code></pre>