Python telnetlib 模块
实例
演示 telnet 模块:
import telnetlib
# telnetlib 提供了一个 Telnet 客户端
print('Module for Telnet protocol')
print('Use Telnet() to create connections')
亲自试一试 »
定义和用法
telnetlib 模块提供了一个用于网络通信的 Telnet 客户端实现。
使用它连接到 Telnet 服务器、自动化远程管理或与旧版网络服务交互。
注意:此模块自 Python 3.11 起已弃用,并将于 Python 3.13 中移除。
成员
| 成员 | 描述 |
|---|---|
| Telnet | Telnet 客户端连接的类。 |
| Telnet.close() | 关闭连接。 |
| Telnet.open() | 连接到主机。 |
| Telnet.read_all() | 读取所有数据直到遇到文件末尾 (EOF)。 |
| Telnet.read_until() | 读取直到遇到指定的字节串。 |
| Telnet.write() | 向套接字写入字节串。 |

