如何使用python将F2键发送到远程主机 [英] how to send F2 key to remote host using python

查看:26
本文介绍了如何使用python将F2键发送到远程主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将 F2 密钥发送到 telnet 主机.我如何使用 python 发送它...使用 getch() 我发现用于 F2 键的字符 < 但在发送时>,它不起作用.我认为有一种方法可以发送特殊功能键,但我找不到它.如果有人知道请帮助我.提前致谢

I have to send F2 key to telnet host. How do I send it using python...using getch() I found that the character < used for the F2 key but when sending >, its not working. I think there is a way to send special function keys but I am not able to find it. If somebody knows please help me. Thanks in advance

推荐答案

扩展键(非字母数字或符号)由单个字符序列组成,序列取决于您告诉 telnet 服务器您所在的终端使用.您需要发送序列中的所有字符才能使其工作.在这里,使用 od -c <<<'CtrlVF2' 我能够看到 \x1b0Q 的序列 使用 xterm 终端.

Extended keys (non-alphanumeric or symbol) are composed of a sequence of single characters, with the sequence depending on the terminal you have told the telnet server you are using. You will need to send all characters in the sequence in order to make it work. Here, using od -c <<< 'CtrlVF2' I was able to see a sequence of \x1b0Q with the xterm terminal.

这篇关于如何使用python将F2键发送到远程主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆