Python—在同一远程服务器上复制文件的最有效方法
我希望提高PythonLamda的性能,它将文件复制到同一个sftp服务器上进行备份。这是我当前的代码:Python—在同一远程服务器上复制文件的最有效方法,python,paramiko,pysftp,Python,Paramiko,Pysftp,我希望提高PythonLamda的性能,它将文件复制到同一个sftp服务器上进行备份。这是我当前的代码: for attr in sftp_server.listdir_attr(): if dt.datetime.fromtimestamp(attr.st_mtime) > date_limit: c = sftp_server.open(attr.filename, 'r') d = c.read() with sftp_serv
for attr in sftp_server.listdir_attr():
if dt.datetime.fromtimestamp(attr.st_mtime) > date_limit:
c = sftp_server.open(attr.filename, 'r')
d = c.read()
with sftp_server.open(copy_target_1 + attr.filename, 'w') as x:
x.write(d)
with sftp_server.open(copy_target_2 + attr.filename, 'w') as y:
y.write(d)
c.close()
有没有办法提高复印速度?有我可以使用的图书馆吗?谢谢您使用的是哪种python版本?如果您使用的是python3.x,请删除python2.7,反之亦然。如果希望ans同时在这两种情况下工作,请删除3.x和2.7标记。只有python标记将不起作用。看,这个链接问题与python无关。我正在尝试使用AWS lamdas自动化复制过程。