On May 29, 3:36 pm, loial <[EMAIL PROTECTED]> 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?
It's so e
On Thu, 29 May 2008 01:36:44 -0700, loial 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?
Of course yo
On May 29, 3:36 am, loial <[EMAIL PROTECTED]> 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?
Take the
2008/5/29, loial <[EMAIL PROTECTED]>:
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.
En Thu, 29 May 2008 18:08:28 -0300, BJörn Lindqvist <[EMAIL PROTECTED]>
escribió:
Open('3rd','w').writelines(set(
Open('3rd', 'w').writelines(set(open('2nd').readlines())-set(open('1st')))
2008/5/29, loial <[EMAIL PROTECTED]>:
> 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 w
On May 29, 1:36 am, loial <[EMAIL PROTECTED]> wrote:
> only those lines that appear in the 2nd file but not in the 1st file.
set(file_2_recs).difference(set(file_1_recs)) will give the recs in
file_2 that are not in file_1 if you can store both files in memory.
Sets are indexed and so are faster t
On May 29, 6:36 pm, loial <[EMAIL PROTECTED]> 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?
>>> file1
Another way of doing this might be to use the module difflib to
calculate the differences. It has a sequence matcher under it which
has the function get_matching_blocks
difflib is included with python.
On May 29, 2:02 pm, Chris <[EMAIL PROTECTED]> wrote:
> On May 29, 10:36 am, loial <[EMAIL PROT
On May 29, 10:36 am, loial <[EMAIL PROTECTED]> 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?
How larg
loial 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.
lines_in_file2 = set(open("file2").readlines())
for line in open("file1"):
if line not in lines_in_file2:
print line
Kalibr wrote:
> On May 29, 6:36 pm, loial <[EMAIL PROTECTED]> 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
>> anythin
On May 29, 6:36 pm, loial <[EMAIL PROTECTED]> 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 u
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?
--
http://mail.python.org/mailman/listinfo/python-list
13 matches
Mail list logo