python连接远程ftp服务器并列出目录下文件的方法
2015-04-01 10:47
1136 查看
本文实例讲述了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程序设计有所帮助。
您可能感兴趣的文章:
相关文章推荐
- python列出目录下指定文件与子目录的方法
- python列出目录下指定文件与子目录的方法
- python对指定目录下文件进行批量重命名的方法
- python输出当前目录下index.html文件路径的方法
- python实现带错误处理功能的远程文件读取方法
- python使用socket远程连接错误处理方法
- python使用socket连接远程服务器的方法
- python使用socket连接远程服务器的方法
- python使用socket远程连接错误处理方法
- python实现带错误处理功能的远程文件读取方法
- python删除文件与目录的方法 转载
- Python.h:没有那个文件或目录 错误的方法
- Python使用reportlab将目录下所有的文本文件打印成pdf的方法
- Python使用reportlab将目录下所有的文本文件打印成pdf的方法
- Python简单删除目录下文件以及文件夹的方法
- Python简单删除目录下文件以及文件夹的方法
- python获取目录下所有文件的方法
- python获取目录下所有文件的方法
- PHP使用递归方式列出当前目录下所有文件的方法
- PHP使用递归方式列出当前目录下所有文件的方法