python连接远程ftp服务器并列出目录下文件的方法,
python连接远程ftp服务器并列出目录下文件的方法,
本文实例讲述了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利用多进程将大量数据放入有限内存的教程,pyt
- python查找目录下指定扩展名的文件实例,
- 简单的编程0基础下Python入门指引,python入门指引
- 用Python制作简单的朴素基数估计器的教程,python基数教
- 分析在Python中何种情况下需要使用断言,python何种情况
- 极简的Python入门指引,极简python入门
- 简单的Python2.7编程初学经验总结,python2.7经验总结
- Python的Django框架中的select_related函数对QuerySet 查询的优
- 用实例详解Python中的Django框架中prefetch_related()函数对数
- 利用Django框架中select_related和prefetch_related函数对数据库
评论关闭