我正在尝试使用Python中的ftplib上传文件.
ftp = FTP('...')
ftp.login('user', 'pass')
f = open(filename)
ftp.storbinary(filename, f)
f.close()
ftp.quit()
Run Code Online (Sandbox Code Playgroud)
storbinary正在返回error_perm: 500 Unknown command.,这很奇怪,因为我遵循其规范.Google搜索返回的信息非常少.有谁遇到过这个问题?
看起来你的使用storbinary不正确.您想传递"STOR filename-at-location", f)发送文件.这有用吗?
ftp = FTP('...')
ftp.login('user', 'pass')
with open(filename) as contents:
ftp.storbinary('STOR %s' % filename, contents)
ftp.quit()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2955 次 |
| 最近记录: |