#!/usr/bin/python # -*- coding: GBK -*- #--------------------------------------------------------------------- #Writer £ºMark #×Ô¶¯ÐÞ¸ÄÎļþGeneralProgramme.txtÖеÄMD5 #--------------------------------------------------------------------- #½Å±¾ËµÃ÷ #--------------------------------------------------------------------- #µ¼Èë import os import md5 #--------------------------------------------------------------------- #È«¾Ö±äÁ¿ #--------------------------------------------------------------------- #--------------------------------------------------------------------- #Âß¼­ÊµÏÖ os_path = os.getcwd() checkFilePath = os.getcwd() + '\\GeneralProgramme.txt' checkFile = open( checkFilePath , 'r') date = [ line.split('\t') for line in checkFile.readlines() ] checkFile.close() writelist = [] for i in range(0 , len(date)): dateList = date[i] if not i: #µÚÒ»ÐÐ writelist.append( dateList ) continue dateName = dateList[0] datePath = dateList[1] dateMD5 = dateList[2] dateMsg = dateList[3] curFile = open( os_path + '%s.txt'%datePath ,'rb') curFilemd5 = md5.md5(curFile.read()).hexdigest() curFile.close() writelist.append( [ dateName , datePath , curFilemd5 , dateMsg ]) checkFile = open( checkFilePath , 'w') for line in writelist: for msgCount in range(len(line)): msg = line[msgCount] checkFile.write(msg) if msgCount != len(line) - 1: checkFile.write('\t') checkFile.close() os.system('pause')