At first, happy new year to all of you. I am trying to write a little script which uses one file as input and looks if the string from this file are in target file. And if not prints out that line/string so that i know which strings must be added to complete the target file. The format of the target file is different as the source/string query file.
I tried this but it gives nothing out: # ------------------------- rom optparse import OptionParser import os #import re # ------------------------------ def help_here(): print """ I need the input file and the file to check. Both files must exist. Try --help. """ exit() # ------------------------------ parser = OptionParser() parser.add_option("-i", "--input-file", type="string", dest="input_file", help="input file with querys to check") parser.add_option("-f", "--file-to-check", type="string", dest="file_to_check", help="file which will be checked with querys from input file") (options, args) = parser.parse_args() input_file=options.input_file file_to_check=options.file_to_check infi = open(input_file,"r") ftck = open(file_to_check,"r") ftck_datei=ftck.read() ftck.close() for a in infi: found = ftck_datei.find(a) if found==-1: print a infi.close() # ------------------------------ And here some source file/querys and an target file: #-------------------------------- Colorful Tabs Cookie Monster Download Statusbar DownThemAll FoxyProxy NoScript ScrapBook TrackMeNot Adblock Plus Tab Mix Plus gTranslate #---------------------------------- #--------------------------------- Firefox AddOns which are useful Colorful Tabs Cookie Monster Download Statusbar DownThemAll FoxyProxy NoScript ScrapBook TrackMeNot Adblock Plus Tab Mix Plus gTranslate UserAgentSwitcher Greasemonkey Greasefire DOM Inspector Firebug RefControl #------------------------------------ The thing is that the target file could be a XML file or something so that it looks if the query is in the line of the targetfile. Else i could use diff but my files are not the exact text but have strings in it which i want to query. Thank you. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor