[root@node110 pexpect]# cat simple9_before_after.py
#1/usr/bin/env python
import pexpect
import sys
child = pexpect.spawn('ssh root@192.168.198.121')
fout = file('mylog.txt','w')
child.logfile = fout
child.expect(["password:"])
child.sendline("123456")
print "before:"+child.before
print "after:"+child.after
2017-04-10
before_after
评论
发表评论
姓 名: