title: Printing the line in a text file that contains a string
body: <p>I'm trying to get the line of a text file that contains a certain string and printing the 3rd number or string in the line. The text file looks like:</p>
  
  <pre><code>1997 180 60 bob
  
  1997 145 59 dan
  </code></pre>
  
  <p>If the input text contains <code>bob</code>, my code should print <code>60</code>.</p>
  
  <p>Here's what I have so far:</p>
  
  <pre><code>calWeight = [line for line in open('user_details.txt') if name in line]
  stringCalWeight = str(calWeight)
  print (stringCalWeight)
  </code></pre>
  
  <p>How can I fix it?</p>