title: How to get the second line of a string in Python
body: <p>I'm using a web service which responds like this....</p>
  
  <pre><code>error code|text|reference
  0|sms submitted|11010d3b0d6872af47b938aebb450d06-3
  </code></pre>
  
  <p>At the moment I check if <code>status_msg starts</code> with <code>error</code></p>
  
  <pre><code> if status_msg.startswith('error'):
  </code></pre>
  
  <p>which is a bad way of doing it. </p>
  
  <p>How Can I get the actual <code>error code</code> from the response in Python in this example it is <code>0</code></p>
  
  <p>I have tried this <code>go to second line, get first number</code>:</p>
  
  <pre><code> if status_msg.startswith('error') and not status_msg.splitlines()[2][1:] == 0:
  </code></pre>