On Sun, 07 Aug 2005 01:33:39 +0200, Eduard Bloch <edi@gmx.de> wrote:
Moin Tilo! Tilo Schwarz schrieb am Sonntag, den 07. August 2005:Oder: from sys import stdout from sets import Set files = ["/tmp/pc1.pkgs", "/tmp/pc2.pkgs"] sets = [Set(file(f).readlines()) for f in files] intersection = reduce(lambda x,y: x & y, sets) stdout.writelines(intersection)Viel zu lang, und langsamer als perl -ne 'print $_ if $seen{$_}; $seen{$_}=1' file1 file2
Ich weiß nicht, ob Du das OP gelesen hast, da ging's um mehrere (n > 2) Dateien. Das hier tut da wohl nich ...
Viele Grüße, Tilo