title: How to find words in text files with Python
body: <p>I am new to python and am trying to create a function in python that finds the lines where the word occurs in a text file and prints the line numbers. The function takes the text file name and list of words as input. I don't know where to start.</p>
  
  <p>Example</p>
  
  <pre><code>index("notes.txt",["isotope","proton","electron","neutron"])
  </code></pre>
  
  <p>isotope   1<br>
  proton    3<br>
  electron  2<br>
  neutron   5  </p>
  
  <p>This is some random code that I made with text; so, I don't know if it can help me or not.</p>
  
  <pre><code>def index():
      infile=open("test.txt", "r")
      content=infile.read()
      print(content)
      infile.close()
  </code></pre>
  
  <p>The goal is to be able to find the words in the text file like a person would find a word in the index of a book.</p>