child = pexpect.spawn (\'/bin/bash\') child.sendline(\'ls\') print(child.readline()) print child.before, child.after
All I get with this code in my
Try the following:
import pexpect child = pexpect.spawn('ls') print child.read() # not readline
The read() will give you the entire output of the ls.
read()