当前位置: 移动技术网 > 科技>软件教程>系统工具 > python连接远程ftp服务器以及列出目录下文件的方法

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

2015年04月02日  | 移动技术网科技  | 我要评论
python连接远程ftp服务器以及列出目录下文件的方法

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

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

1

2

3

4

5

6

7

8

9

10

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

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网