问题描述
我必须将 密钥发送到 telnet 主机.我如何使用 python 发送它...使用 getch()
我发现用于 键的字符 <
但在发送时>
,它不起作用.我认为有一种方法可以发送特殊功能键,但我找不到它.如果有人知道请帮助我.提前致谢
I have to send key to telnet host. How do I send it using python...using getch()
I found that the character <
used for the 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 <<<'
'
我能够看到 \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 <<< '
'
I was able to see a sequence of \x1b0Q
with the xterm
terminal.
这篇关于如何使用python将F2键发送到远程主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!