当我使用此代码从 FTP 服务器下载 zip 文件时,它返回已损坏。有谁知道为什么?
from ftplib import FTP
import getpass
user = raw_input('Username: ')
password = getpass.getpass()
host = raw_input('Host:')
ftp = FTP(host,user,password)
ftp.retrlines('LIST')
f_file = raw_input('What is the name of the file you would like to download? ')
print 'Opening local file...'
l_file = open(f_file, 'w')
print "Getting", f_file
ftp.retrbinary('RETR ' + f_file, l_file.write)
print "Closing", f_file
l_file.close()
print 'Closing FTP connection'
ftp.close()