telnetlib入门

 

 

import telnetlib

tn = telnetlib.Telnet("127.0.0.1","7171") #服务器,端口

result = tn.read_very_eager().decode('ascii')
print(result)

cmd = "status,1\r\n"
tn.write(cmd.encode())
print(cmd)

result = tn.read_very_eager().decode('ascii')
print(result)

tn.close()

 

posted @ 2020-04-17 11:52  quanzhan  阅读(832)  评论(0编辑  收藏  举报