Larry Bates wrote:
> If the files aren't terribly large (not tested):
>
> correct_lines=open(r"C:\Python25\Scripts\Output" \
> "\correct_settings.txt", "r").readlines()
>
> current_lines=open(r"C:\Python25\Scripts\Output\output.txt",
> "r").readlines()
>
> for line in current_settings:
> if line in correct_lines:
> print line + " found"
You only have to read the "inner" file into memory, and a set is more
efficient than a list here:
current_settings = open(...)
correct_settings = set(open(...))
for line in current_settings:
if line in correct_settings:
print line.rstrip(), "found"
Of course your suggestion of difflib is spot-on.
Peter
--
http://mail.python.org/mailman/listinfo/python-list