from method import *
file_url = "http://disc.static.szse.cn/download" # 下载地址
save_dir = r"D:\Users\Desktop\data\notice\test\\"
path1 = r'D:\Users\Desktop\data\notice\公告文件下载测试.txt'
all = File_List(path1)
for i in range(len(all)):
url_f = file_url + all[i]
date_t = all[i].split('/')[-2]
filename = all[i].split('/')[-1]
print(filename)
save_dir_t = os.path.join(save_dir, date_t)
if not os.path.isdir(save_dir_t):
os.makedirs(save_dir_t)
save_path = os.path.join(save_dir_t, filename)
if not os.path.exists(save_path):
urllib.request.urlretrieve(url_f, save_path)
网友评论