import os
folder_paths = ['./']
dst_file1 = '1.xls'
dst_file2 = '2.xls'
for itemFolder in folder_paths:
listFiles = os.listdir(itemFolder)
for itemFiles in listFiles:
if (itemFiles[-4:] == '.xls'):
size_file = os.stat(itemFolder+'/'+itemFiles).st_size/1024
if (size_file > 200):
os.rename(itemFolder+'/'+itemFiles, itemFolder+'/'+dst_file1)
else:
os.rename(itemFolder+'/'+itemFiles, itemFolder+'/'+dst_file2)
openedFile = ['aaa', 'bbb', 'ccc', 'xxx']
for index, line in enumerate(openedFile):
if 'c' in line:
if (openedFile[index-1]):
print(openedFile[index-1])
with open(logfile, 'r', encoding='utf-8') as log:
tmpLog = log.readlines()
for index, line in enumerate(tmpLog)):
if 'Domain not found' in line:
if (tmpLog[index-1]):
...