我有一个csv文件,其中包含文件路径,例如:oa_package/08/e0/PMC13900。焦油gz,oa_包/b0/ac/PMC13901。焦油gz等等
如果有人打字ftp.ncbi.nlm文件.nih.gov/pub/pmc/oa_包/08/e0/PMC13900.焦油gz在浏览器中,它会自动下载文件,有没有办法在python中复制这种行为?在
以前,我成功地使用了以下try/catch和主机.listdir('.')从同一目录迭代和下载文件。在这种情况下,我打算下载当前工作目录之外的文件。在
host = ftputil.FTPHost('ftp.ncbi.nlm.nih.gov', 'anonymous', email)
path = "pub/pmc/"
host.chdir(path) #gets to ftp.ncbi.nlm.nih.gov/pub/pmc/
outFile = outDir + file
print("retrieving file:", file)
try:
host.download(file, outFile) #file is zip file
except:
print("WARNING: File could not be downloaded")
回溯错误是:
^{2}$
目前没有回答
相关问题 更多 >
编程相关推荐