python 从远程服务器下载东西的代码
时间:2023-01-23 11:00:55
# _*_ coding:utf-8 _*_
# name gefile.py
import os
import stat
import socket
import paramiko
FILES=["filenameA","filenameB","filenameC","filenameD","filenameE"]
USERNAME="root"
PASSWORD="123456"
HOST="192.168.1.66"
PORT=22
remotefile="/root/filename"
localpath=r'D:\docs\filename_download'
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((HOST,PORT))
t = paramiko.Transport(sock)
t.start_client()
t.auth_password(USERNAME,PASSWORD)
sftptest=paramiko.SFTPClient.from_transport(t)
sftptest.get(remotefile,localpath)
sftptest.close()
t.close()
sock.close()
标签:python,远程服务器
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
JavaScript 作用域scope简单汇总
2024-04-18 10:54:55
python字符串定义的三种方式
2022-05-27 08:17:57
使用Django的模版来配合字符串翻译工作
2023-11-17 06:03:47
关于Flask项目无法使用公网IP访问的解决方式
2021-01-03 10:04:00
![](https://img.aspxhome.com/file/2023/3/107683_0s.jpg)
教你如何升级SQL Server数据库系统
2009-01-19 14:42:00
Python生成随机数的方法详解(最全)
2023-05-04 12:36:08
![](https://img.aspxhome.com/file/2023/5/71355_0s.png)
Python使用plt.boxplot() 参数绘制箱线图
2022-06-03 16:30:09
![](https://img.aspxhome.com/file/2023/5/127735_0s.png)
python列表和字符串的三种逆序遍历操作
2022-09-09 03:00:56
JSP使用MVC模式完成删除和修改功能实例详解
2024-03-20 03:39:42
numpy的文件存储.npy .npz 文件详解
2023-02-08 17:16:35
基于python实现名片管理系统
2023-02-03 12:33:50
![](https://img.aspxhome.com/file/2023/2/104792_0s.jpg)
如何使数据库中取出的数据保持原有格式
2008-11-27 16:16:00
Python cookbook(数据结构与算法)保存最后N个元素的方法
2023-08-08 05:06:38
![](https://img.aspxhome.com/file/2023/9/62279_0s.png)
fso怎样判断一个盘上是否有文件
2007-09-26 12:35:00
asp如何用下拉列表显示数据库里的内容?
2010-06-16 09:54:00
js实现ajax分页完整实例
2024-05-21 10:12:49
vuex实现数据状态持久化
2024-04-30 10:34:38
Django 多对多字段的更新和插入数据实例
2022-09-11 01:17:04
![](https://img.aspxhome.com/file/2023/5/102775_0s.jpg)
Python3 中文文件读写方法
2021-07-14 20:02:39
Python Web框架之Django框架文件上传功能详解
2023-06-25 11:19:40
![](https://img.aspxhome.com/file/2023/5/65045_0s.jpg)