Paramiko recv output generating all the commands output and expecting only last command output

时间:2017-04-24 17:31:55

标签: python paramiko

I am using paramiko for ssh interfactive shell for switches.

Below is the sample example code (Note complete code):

remote_conn.send("\n")
remote_conn.send("show version")
# Wait for the command to complete
#time.sleep(1)
remote_conn.send("\n")
remote_conn.send("show interface brief")
# Wait for the command to complete
time.sleep(3)
if remote_conn.recv_ready():
    sp_detail = remote_conn.recv(5000)
print(sp_detail)

recv command print both show version output and show interface brief.

How do i get only show interface brief output to variable sp_detail

I referred below link and used if statement same way they used but still i am getting all the commands output.

click here

Please help

0 个答案:

没有答案