compare list

Simon Brunning simon.brunning at gmail.com
Tue Nov 15 05:27:45 EST 2005


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/



More information about the Python-list mailing list