[Tutor] Maybe advanced pexpect question?

Chris Fuller cfuller084 at thinkingplanet.net
Sun Mar 23 14:31:41 CET 2008


What about Alt keys?  I was thinking terminal control voodoo.  But I don't 
know any.  man 5 termcap might be a start, though.

Cheers

On Sunday 23 March 2008 06:58, Kent Johnson wrote:
> 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')
>
> Kent
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list