1) what are these characters: \x1b]0; ~\x07\x1b[?1034h in line '\x1b]0;[EMAIL PROTECTED]:[EMAIL PROTECTED] ~]'?
2) Also, how come I don't get 0 or 2(excuting ls command exit code) from result.split('\r\n')[0] or result.split('\r\n')[1] ? This is what I get: >>> import pexpect >>> child=pexpect.spawn('ssh [EMAIL PROTECTED]') >>> child.sendline("ls mytest.log > /dev/null 2>&1; echo $?") 41 >>> child.before >>> print child.before None >>> print child.after None >>> child.expect([pexpect.TIMEOUT, '\$ ']) 1 >>> result=child.before >>> print result.split('\r\n')[1] [EMAIL PROTECTED] ~] >>> print result.split('\r\n')[0] Last login: Mon Dec 31 20:52:09 2007 from com1 >>> print result.split('\r\n') ['Last login: Mon Dec 31 20:52:09 2007 from com1\r', '\x1b]0;[EMAIL PROTECTED]:[EMAIL PROTECTED] ~]'] -- http://mail.python.org/mailman/listinfo/python-list