i write my code in python 2 and everything going well but when i use the same code in python3 the output not so fit as i want or not look as in python 2 how i solve this issue ?
import paramiko
import time
UserName = "*****"
Password = "******"
ip = "10.226.159.1"
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.connect(hostname=ip, username=UserName, password=Password)
remote_connection = ssh_client.invoke_shell()
remote_connection.send("show interfaces transceiver \n")
time.sleep(10)
output = remote_connection.recv(65535)
print (output)
the output in python2 :
Rp#sh int tra
If device is externally calibrated, only calibrated values are printed.
++ : high alarm, + : high warning, - : low warning, -- : low alarm.
NA or N/A: not applicable, Tx: transmit, Rx: receive.
mA: milliamperes, dBm: decibels (milliwatts).
Optical Optical
Temperature Voltage Tx Power Rx Power
Port (Celsius) (Volts) (dBm) (dBm)
--------- ----------- ------- -------- --------
Te1/1/1 24.3 3.26 -2.9 -1.8
Te1/1/3 34.7 3.35 -1.1 -13.7
Te1/1/4 32.6 3.20 -3.5 -1.6
the output in python 3:
b'\r\nRp#sh int tra\r\nIf device is externally calibrated, only calibrated values are
printed.\r\n++ : high alarm, + : high warning, - : low warning, -- : low alarm.\r\nNA or
N/A: not applicable, Tx: transmit, Rx: receive.\r\nmA: milliamperes, dBm: decibels
(milliwatts).\r\n\r\n Optical Optical\r\n Temperature Voltage Tx Power Rx Power\r\nPort (Celsius) (Volts) (dBm) (dBm)\r
\n--------- ----------- ------- -------- --------\r\nTe1/1/1 25.2 3.26 -2.9 -1.8 \r\nTe1/1/3 35.5 3.35 -1.1 -13.6 \r\nTe1/1/4 33.6 3.21 -3.5 -1.6 \r\n\r\n\r\n