def do_telnet(Host): '''Telnet远程测试连接:客户端连接Linux服务器''' try: tn = telnetlib.Telnet(Host, port=80, timeout=5) tn.close() # tn.write('exit\n') except: return False; return True;
需要import telnetlib
def do_telnet(Host): '''Telnet远程测试连接:客户端连接Linux服务器''' try: tn = telnetlib.Telnet(Host, port=80, timeout=5) tn.close() # tn.write('exit\n') except: return False; return True;
需要import telnetlib
转载于:https://www.cnblogs.com/t-witness/p/3530201.html