Output.append( str(Lot[i][0]) + " " + str(Lot[i][1]) + " " + str(Lot[i][2])) Output.append("") # Add line between lot items and errors Errors.sort() # Sort errors and reformat variable ErrorsCombined = [str(E[0]) + " " + str(E[1]) for E in Errors] Errors = ErrorsCombined for i in Errors: # remove non ascii characters and add errors to main output variable RemovedAscii = i.encode('ascii', 'ignore').decode() if RemovedAscii.split("|")[0] not in [ Output[a].split("|")[0] for a in range(len(Output)) ]: Output.append(RemovedAscii) # Put headers at the beginning of output variable Output.insert(0, str(len(Errors)) + " Errors out of " + str(len(Data))) Output.insert(1, "") Mail.Send(Output) # Send Output as mail # Save Output to file DisplayDataPosition = str(os.path.dirname( os.path.dirname(__file__))) + '/DataBase/DisplayData.txt' with open(DisplayDataPosition, 'w') as out_file: json.dump(Display, out_file) print("Starting Display") Disp.Startup(Display) # Start GUI
#!python3 # -*- coding: utf-8 -*- ''' @Author: Anscor @LastEditors: Anscor @Description: 主文件,整合所有模块 @Date: 2019-01-27 @LastEditTime: 2019-02-23 ''' import Mail import time import random MinTime = 173 MaxTime = 352 if __name__ == "__main__": while True: Mail.Send() time.sleep(random.randint(MinTime, MaxTime))