📅  最后修改于: 2022-03-11 14:45:48.364000             🧑  作者: Mango
import paramiko
import os
paramiko.util.log_to_file('logfile.log')
host = "101.102.103.104"
port = 22
transport = paramiko.Transport((host, port))
password = "pass"
username = "user"
sftp = paramiko.SFTPClient.from_transport(transport)
filepath = '~/remote/file'
localpath = '~/local/file'
sftp.get(filepath, localpath)
sftp.close()
transport.close()