【发布时间】:2016-05-05 23:55:42
【问题描述】:
我正在尝试将文件上传到 ftp 服务器,但它不断出现错误:TypeError: storbinary() 缺少 1 个必需的位置参数:'fp'。代码如下:
import ftplib
ftp = ftplib.FTP("Address","Username","Passcode")
print(ftp.getwelcome())
myfile=open("ftptest.txt","r")
ftp.storbinary("STOR ftptest.txt")
myfile.close()
ftp.cwd("")
ftp.quit()
您能告诉我为什么会发生错误以及任何可能的解决方案吗?
【问题讨论】:
-
无关:以二进制模式打开文件:
'rb'.
标签: python python-3.x ftp ftplib