本文实例讲述了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 |
您可能感兴趣的文章:
如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!
网友评论