[Tutor] Maybe advanced pexpect question?

Kent Johnson kent37 at tds.net
Sun Mar 23 12:58:19 CET 2008

Nathan McBride wrote:
> I've used pexpect for a few projects and love it.  Basically pexpect
> lets you spawn a program and interact with it from code like you
> yourself were running it in a console.  How would you send the ctrl key?

I don't use pexpect, so I am guessing...

The ctrl key by itself is not a character so you can't send that. ctrl-C 
is a character that is represented in a string as \x03. I expect you 
would send a control character with sendline(), for example to sent 
ctrl-C try
   child.sendline ('\x03')


More information about the Tutor mailing list