python自动化windows系统使用crt的ssh登录服务器求助
编辑代码如下:
coding=utf-8
import serial,paramiko
import serial.tools
transport = paramiko.Transport((‘192.168.2.29’, 22)) #获取连接
transport.connect(username=‘nannan’,password=’******’)
ssh = paramiko.SSHClient()
ssh._transport = transport
class SSHConnection(object):
def init(self, host, port, username, password):
self._host = host
self._port = port
self._username = username
self._password = password
self._transport = None
self._sftp = None
self._client = None
self._connect() # 建立连接
def _connect(self):
transport = serial.paramiko.Transport((self._host, self._port))
transport.connect(username=self._username, password=self._password)
self._transport = transport
请问一下代码执行以后应该怎么使程序输出crt中读到的log,并且保存log!