1 回答
TA贡献1796条经验 获得超7个赞
虽然wget没有提到,你可以自己改变它。使用os.path.basename()获取文件名,并检查它是否存在。像这样:
import wget
import os
urls = ['https://www.iedb.org/downloader.php?file_name=doc/epitope_full_v3.zip',
'https://www.iedb.org/downloader.php?file_name=doc/tcell_full_v3.zip',
'https://www.iedb.org/downloader.php?file_name=doc/bcell_full_v3.zip',
'https://www.iedb.org/downloader.php?file_name=doc/mhc_ligand_full_single_file.zip']
path = '/home/david/data/files/zip_files'
for url in urls:
filename = path + '/' + os.path.basename(url) # get the full path of the file
if os.path.exists(filename):
os.remove(filename) # if exist, remove it directly
wget.download(url, out=filename) # download it to the specific path.
添加回答
举报