def localExcel(dayslist):
df = pd.read_excel(excelpath)
test_data = []
for i in df.index.values:
row_data = df.loc[i].reindex(
['excel1', 'excel2', 'excel3', 'excel4',
'excel5'])
spider_time = str(row_data[0]).split(' ')[0].replace('-', '')
device = str(row_data[1])
app_name = str(row_data[2])
pathlist1=str(row_data[3]).split('/')
image_path_ls=''
image_path_d=""
if len(pathlist1)>4:
image_path_ls = pathlist1[2]+"/"+pathlist1[4]
if len(pathlist1)==3:
image_path_ls = pathlist1[1] + "/" + pathlist1[2]
image_path_ds = str(row_data[4])
pathlist2=str(row_data[4]).split('/')
if len(pathlist2)>4:
image_path_ds = pathlist2[2]+"/"+pathlist2[4]
if len(pathlist2)==3:
image_path_ds = pathlist2[1] + "/" + pathlist2[2]
if exceldevice in device:
if excelappname == app_name:
try:
for dat in dayslist:
try:
dat=str(dat).replace("-","")
spider_time=dat
image_path_l=dat+'/'+image_path_ls
image_path_d=dat+'/'+image_path_ds
imageDirPath = "E:\\images\\" + excelappname + "\\" + str(spider_time)
isExists = os.path.exists(imageDirPath)
if not isExists:
os.makedirs(imageDirPath)
if '/' in image_path_l:
shutil.copy('E:\\' + "images\\childfolder\\" + image_path_l, imageDirPath)
shutil.copy('E:\\' + "images\\childfolder\\" + image_path_d, imageDirPath)
else:
image_path_l = "images//childfolder//" + str(
spider_time) + "//" + excelappname + "//" + image_path_l
image_path_d = "images//childfolder//" + str(
spider_time) + "//" + excelappname + "//" + image_path_d
shutil.copy('E://' + image_path_l, imageDirPath)
shutil.copy('E://' + image_path_d, imageDirPath)
except Exception as e:
pass
except Exception as e:
pass