child = pexpect.spawn (\'/bin/bash\') child.sendline(\'ls\') print(child.readline()) print child.before, child.after
All I get with this code in my
import sys import pexpect child = pexpect.spawn('ls') child.logfile = sys.stdout child.expect(pexpect.EOF)
See the manual entry on the subject.