Python3 .replace Yielding Typeerror: A Bytes-like Object Is Required, Not 'str'
I've been trying to read the output from a server with this code: s = paramiko.SSHClient() s.load_system_host_keys() s.set_missing_host_key_policy(paramiko.AutoAddPolicy()) s.conne
Solution 1:
You have to decode bytes object to get string. To do this:
output = stdout.read().decode("UTF-8")
in there replace UTF-8 with the encoding of your remote machine.
Post a Comment for "Python3 .replace Yielding Typeerror: A Bytes-like Object Is Required, Not 'str'"