- login(user='',passwd='', acct='') 登錄到FTP 服務器,所有的參數都是可選的
- pwd() 當前工作目錄
- cwd(path) 把當前工作目錄設置為path
- dir([path[,...[,cb]]) 顯示path 目錄里的內容,可選的參數cb 是一個回調函數,會被傳給retrlines()方法
- nlst([path[,...]) 與dir()類似,但返回一個文件名的列表,而不是顯示這些文件名
- retrlines(cmd [, cb]) 給定FTP 命令(如“RETR filename”),用於下載文本文件。可選的回調函數cb 用於處理文件的每一行
- retrbinary(cmd, cb[,bs=8192[, ra]]) 與retrlines()類似,只是這個指令處理二進制文件。回調函數cb 用於處理每一塊(塊大小默認為8K)下載的數據。
- storlines(cmd, f) 給定FTP 命令(如“STOR filename”),以上傳文本文件。要給定一個文件對象f
- storbinary(cmd, f[,bs=8192]) 與storlines()類似,只是這個指令處理二進制文件。要給定一個文件對象f,上傳塊大小bs 默認為8Kbs=8192])
- rename(old, new) 把遠程文件old 改名為new
- delete(path) 刪除位於path 的遠程文件
- mkd(directory) 創建遠程目錄
此處給出官方給的介紹
- Methods defined here:
-
|
-
| __init__(self, host='', user='', passwd='', acct='', keyfile=None, certfile=None, context=None, timeout=<object object>, source_address=None)
-
|
-
| auth(self)
-
| Set up secure control connection by using TLS/SSL.
-
|
-
| login(self, user='', passwd='', acct='', secure=True)
-
|
-
| ntransfercmd(self, cmd, rest=None)
-
|
-
| prot_c(self)
-
| Set up clear text data connection.
-
|
-
| prot_p(self)
-
| Set up secure data connection.
-
|
-
| retrbinary(self, cmd, callback, blocksize=8192, rest=None)
-
|
-
| retrlines(self, cmd, callback=None)
-
|
-
| storbinary(self, cmd, fp, blocksize=8192, callback=None, rest=None)
-
|
-
| storlines(self, cmd, fp, callback=None)