[python-win32] How to send the Esc key via a telnetlib.Telnetsession?
Tim Roberts
timr at probo.com
Tue Nov 30 02:50:19 CET 2010
Goldsmith, David wrote:
>
> Thanks for the prompt reply, and forgive my ignorance: how do I
> specify in a telnet transmission that 27 is to be interpreted as an
> ascii code? Thanks!
>
Well, this is not specific to Telnet -- it's a Python thing. Telnet
just sucks up whatever bytes you send it, so you just need to create a
Python string with that character. You can do:
telnetlib.Telnet.write( chr(27) )
or
telnetlib.Telnet.write( "\x1b" )
(1B being the hexadecimal value of 27 in decimal)
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list