#!/usr/local2/bin/python2.3 #Compares the db-nums (without prefix) with the nums in the title_dict-file # the ones which aren't in the db-file (= the log-file) are removed import os, string loglist = [] for file in os.listdir('.'): if file[-4:] == '.log': loglist.append(file) done_list = [] for lfile in loglist: lfilec = open(lfile, 'r') for line in lfilec.readlines(): if len(string.split(line)) == 8: if len(string.split(line)[0]) == 9: done_list.append(string.split(line)[0][1:]) #print done_list # raise SystemExit() newf = open('title_dict_n.txt', 'w') oldf = open('title_dict.txt', 'r') for line in oldf.readlines(): if string.split(line)[2][1:] in done_list: newf.write(line) newf.close() oldf.close()