[python-win32] How to send the Esc key viaa telnetlib.Telnetsession?
Goldsmith, David
dgol461 at ECY.WA.GOV
Tue Nov 30 03:28:35 CET 2010
Excellent, thank you both!
DG
-----Original Message-----
From: python-win32-bounces+dgol461=ecy.wa.gov at python.org
[mailto:python-win32-bounces+dgol461=ecy.wa.gov at python.org] On Behalf Of
Tim Roberts
Sent: Monday, November 29, 2010 5:50 PM
To: Python-Win32 List
Subject: Re: [python-win32] How to send the Esc key viaa
telnetlib.Telnetsession?
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.
_______________________________________________
python-win32 mailing list
python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32
More information about the python-win32
mailing list