Best way to compare the contents of two directories

Cliff Wells clifford.wells at comcast.net
Mon Sep 13 16:32:46 EDT 2004


On Mon, 2004-09-13 at 11:37 -0700, Robin Siebler wrote:
> "Raymond Hettinger" <vze4rx4y at verizon.net> wrote in message news:<Zxc1d.412$W73.185 at trndny03>...
> > [Robin Siebler]
> > > However, before I actually compare the files, I want to compare the
> > > directories and if a directory is mising in either set, I want to
> > > report it:
> > 
> > The operative word is "set".
> > 
> > Try using sets.py:
> >      one_only = Set(dirlistone) - Set(dirlisttwo)
> >      two_only = Set(dirlisttwo) - Set(dirlistone)
> > 
> > 
> > Raymond Hettinger
> 
> I get the following error:
> 
> NameError: name 'Set' is not defined
> 
> I'm using ActivePython 2.2.3.  Is this something that has been added
> to a later version of Python?

I think sets were added in 2.3, but either way you must still 'from sets
import Set' before using them.

Regards,
Cliff

-- 
Cliff Wells <clifford.wells at comcast.net>




More information about the Python-list mailing list