python使用telnetlib库文件进行telnet登陆并且进行命令操作设备
import telnetlib
delay_time=1
def telnet_command(tn,command):
tn.write(command + '\n')
time.sleep(delay_time)
msg_list=[]
#i=0
while 1:
#pdb.set_trace()
#if i>=6:
#pdb.set_trace()
#print i
#i=i+1
temp=tn.read_until("--More-- press q to quit display:",5)
if temp.find('More')==-1:
msg_list.append(temp)
break
else:
msg_list.append(temp)
tn.write(' ')
Python Telnetlib 库实战

最低0.47元/天 解锁文章
594

被折叠的 条评论
为什么被折叠?



