python連接遠(yuǎn)程ftp服務(wù)器并列出目錄下文件的方法
來源:易賢網(wǎng) 閱讀:5224 次 日期:2015-04-20 10:42:23
溫馨提示:易賢網(wǎng)小編為您整理了“python連接遠(yuǎn)程ftp服務(wù)器并列出目錄下文件的方法”,方便廣大網(wǎng)友查閱!

本文實(shí)例講述了python連接遠(yuǎn)程ftp服務(wù)器并列出目錄下文件的方法。分享給大家供大家參考。具體如下:

這段python代碼用到了pysftp模塊,使用sftp協(xié)議,對(duì)數(shù)據(jù)進(jìn)行加密傳輸

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

更多信息請(qǐng)查看IT技術(shù)專欄

更多信息請(qǐng)查看技術(shù)文章
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn)

版權(quán)所有:易賢網(wǎng)