[Tutor] Telnet and special characters

Chris Hallman challman at gmail.com
Tue Feb 27 19:08:56 CET 2007

Is it possible to send a F1 "character" over a telnet connection? I've
searched but I can't find a solution. I've tried
SendKeys<http://www.rutherfurd.net/python/sendkeys/>and other methods,
but I can't get it to work.

import telnetlib

pswd = "***"
host = "***"
tn = telnetlib.Telnet(host)
tn.read_until("password:", 7)
tn.write(pswd + "\n")
tn.write(chr(27)) # ESC
tn.write(chr(78)) # Shift N
tn.write(chr(25)) # Down arrow
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070227/a90ebd50/attachment.html 

More information about the Tutor mailing list