SSHClient類的字符編碼可以通過以下方法進行設置:
import paramiko
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname='localhost', username='username', password='password')
client.get_transport().set_keepalive(30)
client.get_transport().set_encoding('utf-8')
import paramiko
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname='localhost', username='username', password='password')
transport = client.get_transport()
transport.set_keepalive(30)
transport.set_encoding('utf-8')
這樣就可以設置SSHClient對象的字符編碼為utf-8。