Compare 2 files and discard common lines

Stefan Behnel stefan_ml at behnel.de
Thu May 29 04:48:25 EDT 2008


Kalibr wrote:
> On May 29, 6:36 pm, loial <jldunn2... at googlemail.com> wrote:
>> I have a requirement to compare 2 text files and write to a 3rd file
>> only those lines that appear in the 2nd file but not in the 1st file.
>>
>> Rather than re-invent the wheel I am wondering if anyone has written
>> anything already?
> 
> You can use the cmp(x, y) function to tell if a string is similar to
> another.

Or "==".

Stefan



More information about the Python-list mailing list