compare list

Shi Mu samrobertsmith at gmail.com
Tue Nov 15 05:58:10 EST 2005


On 11/15/05, Simon Brunning <simon.brunning at gmail.com> wrote:
> On 15/11/05, Shi Mu <samrobertsmith at gmail.com> wrote:
> > it does not work.
> > >>> len(set(lisA).intersection(set(lisB))) == 2
> > Traceback (most recent call last):
> >   File "<interactive input>", line 1, in ?
> > NameError: name 'set' is not defined
>
> 'set' is introduced as a built-in at Python 2.4. If you have 2.3,
> there's an analogous module.
>
> --
> Cheers,
> Simon B,
> simon at brunningonline.net,
> http://www.brunningonline.net/simon/blog/
>
Yes, i am using python 2.3,
I have used from sets import *
but still report the same error:
> > Traceback (most recent call last):
> >   File "<interactive input>", line 1, in ?
> > NameError: name 'set' is not defined



More information about the Python-list mailing list