title: Python, parse string by extracting characters and digits substring
body: <p>I have a string, resulting from some machine learning algorithm, which is generally formed by multiple lines. At the beginning and at the end there can be some lines not containing any characters (except for whitespaces), and in between there should be 2 lines, each containing a word followed by some numbers and (sometimes) other characters.</p>
  <p>Something like this</p>
  <pre><code>
  first_word  3 5 7 @  4
  second_word 4 5 67| 5 [
  
  
  </code></pre>
  <p>I need to extract the 2 words and the numeric characters.</p>
  <p>I can eliminate the empty lines by doing something like:</p>
  <pre><code>lines_list = initial_string.split(&quot;\n&quot;)
  for line in lines_list:
      if len(line) &gt; 0 and not line.isspace():
          print(line)
  </code></pre>
  <p>but now I was wondering:</p>
  <ol>
  <li>if there is a more robust, general way</li>
  <li>how to parse each of the remaining 2 central lines, by extracting the words and digits (and discard the other characters mixed in between the digits, if there are any)</li>
  </ol>
  <p>I imagine reg expressions could be useful, but I never really used them, so I'm struggling a little bit at the moment</p>