[root@node110 pexpect]# cat simple6-output-logfile.py
#!/usr/bin/env python
import pexpect
import sys
shell_cmd='ls -l'
child = pexpect.spawn('/bin/bash',['-c',shell_cmd])
fout = file('mylog.txt','w')
child.logfile=fout
#child.logfile=sys.stdout
child.expect(pexpect.EOF)
2017-04-10
日志输出到文件
评论
发表评论
姓 名: