title: Python how to read output from pexpect child?
body: <pre><code>child = pexpect.spawn ('/bin/bash')
  child.sendline('ls')
  print(child.readline())
  print child.before, child.after
  </code></pre>
  
  <p>All I get with this code in my output is </p>
  
  <pre><code>ls
  
  ls 
  </code></pre>
  
  <p>But when my code is </p>
  
  <pre><code>child = pexpect.spawn('ls')
  print(child.readline())
  print child.before, child.after
  </code></pre>
  
  <p>Then it works, but only for the first 2 prints. Am I using the wrong send command? I tried send, write, sendline, and couldn't find anymore.</p>