更新时间:2023-12-05 14:34:46
Paramiko 的 SFTPClient
类 允许你获取一个类似文件的对象,以 Pythonic 的方式从远程文件中读取数据.
Paramiko's SFTPClient
class allows you to get a file-like object to read data from a remote file in a Pythonic way.
假设你有一个开放的SSHClient
:
sftp_client = ssh_client.open_sftp()
remote_file = sftp_client.open('remote_filename')
try:
for line in remote_file:
# process line
finally:
remote_file.close()