📌  相关文章
📜  如何使用 python 代码示例将文件从本地复制到 sftp

📅  最后修改于: 2022-03-11 14:45:48.364000             🧑  作者: Mango

代码示例1
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()