title: Read specific line from a text file into a Python variable?
body: <p>I have a number of text files with a layout like below,</p>
  
  <pre><code>heading
  subheading
  info1
  info2
  info3
  </code></pre>
  
  <p>where the character count of each line will vary from file to file. For each file, I'd like to store line 2 as a Python variable.</p>
  
  <p>I can load the whole file into a variable,</p>
  
  <pre><code>with open('data.txt', 'r') as myfile:
      data=myfile.read().replace('\n', '')
  </code></pre>
  
  <p>but I am unsure how to specify to read only line 2.</p>