title: Search a string in a text file, save a line that contains an item from the list and return NA if the item does not exist in the text file
body: <p>I have a list of items</p>
  
  <pre><code>ls=["John","Tanner",'Mary','Anna','25'] 
  </code></pre>
  
  <p>and a text file:</p>
  
  <pre><code> V1 'John' 'blablablabla...'
   V2 'Anna' 'blablablabla...'
   V3 'Josh' 'blablablabla...'
   V4 'Mary' 'blablablabla...'
   V5 'Steven' 'blablablabla...'
  </code></pre>
  
  <p>I want to search each item of the list inside the text file, and save the line that contains the item.</p>
  
  <pre><code>var=[]
  with open('C:/Maryam/example/test.txt', 'r') as file:
      for line in file:
          for item in ls:
              if item in line:
                  var.append(line)
  
  var   
  </code></pre>
  
  <p>The output already looks like: </p>
  
  <pre><code>["  V1 'John' 'blablablabla...'\n","  V2 'Anna' 'blablablabla...'\n",
  "  V4 'Mary' 'blablablabla...'\n"]
  </code></pre>
  
  <p>But I expect to get something like this:</p>
  
  <pre><code>["  V1 'John' 'blablablabla...'\n", 'NA' , "  V2 'Anna' 'blablablabla...'\n",
  "  V4 'Mary' 'blablablabla...'\n", 'NA']
  </code></pre>
  
  <p>I tried to generate 'NA' in the list but couldn't figure it out.
  The reason I used 
      for line in file:
  cause I want to save the whole line including specific string. Is there any way to use regular expressions, so I could get rid of the for loop on the lines and then save the whole line.
  Thank you.</p>