python连接远程ftp服务器并列出目录下文件的方法

yipeiwu_com5年前服务器

本文实例讲述了python连接远程ftp服务器并列出目录下文件的方法。分享给大家供大家参考。具体如下:

这段python代码用到了pysftp模块,使用sftp协议,对数据进行加密传输

import pysftp
srv = pysftp.Connection(host="your_FTP_server", 
username="your_username",password="your_password")
# Get the directory and file listing
data = srv.listdir()
# Closes the connection
srv.close()
# Prints out the directories and files, line by line
for i in data:
  print i

希望本文所述对大家的Python程序设计有所帮助。

相关文章

php操作SVN版本服务器类代码

SvnPeer.php 复制代码 代码如下: <?php /** * * This class for execute the external program of svn *...

python远程连接服务器MySQL数据库

本文实例为大家分享了python远程连接服务器MySQL数据库的具体代码,供大家参考,具体内容如下 这里默认大家都已经配置安装好 MySQL 和 Python 的MySQL 模块,且默认...

Python3 SSH远程连接服务器的方法示例

Python3 SSH远程连接服务器的方法示例

下载paramiko 首先,我的windows系统上有python2和python3。使用下面命令切换到python3: activate py3 接着使用下面命令下载相关模块:...

ffmpeg通过参数设置调整画质清晰度

ffmpeg通过参数设置调整画质清晰度

H.264有四种画质级别,分别是baseline, extended, main, high:1、Baseline Profile:基本画质。支持I/P 帧,只支持无交错(Progressive)和C...

php集成套件服务器xampp安装使用教程(适合第一次玩PHP的新手)

php集成套件服务器xampp安装使用教程(适合第一次玩PHP的新手)

环境搭建 软件: xampp   下载地址:https://www.apachefriends.org/zh_cn/index.html (建议使用迅雷下载,不然速度...