【发布时间】:2013-07-12 00:07:39
【问题描述】:
child = pexpect.spawn ('/bin/bash')
child.sendline('ls')
print(child.readline())
print child.before, child.after
我在输出中使用此代码得到的只是
ls
ls
但是当我的代码是
child = pexpect.spawn('ls')
print(child.readline())
print child.before, child.after
然后它可以工作,但仅适用于前 2 次打印。我使用了错误的发送命令吗?我尝试了发送、写入、发送,但再也找不到了。
【问题讨论】: