[Python] python链接远程ftp服务器并列出目录下的文件 →→→→→进入此内容的聊天室

来自 , 2021-04-03, 写在 Python, 查看 154 次.
URL http://www.code666.cn/view/5c6287be
  1. import pysftp
  2.  
  3. srv = pysftp.Connection(host="your_FTP_server", username="your_username",
  4. password="your_password")
  5.  
  6. # Get the directory and file listing
  7. data = srv.listdir()
  8.  
  9. # Closes the connection
  10. srv.close()
  11.  
  12. # Prints out the directories and files, line by line
  13. for i in data:
  14.     print i
  15. #//python/8426

回复 "python链接远程ftp服务器并列出目录下的文件"

这儿你可以回复上面这条便签

captcha