How to test if one dict is subset of another?

Jay Tee jeff.templon at gmail.com
Tue Feb 20 14:26:59 EST 2007


On Feb 20, 6:44 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> They are sets, not lists.
>
>    from sets import Set as set  # use in 2.3 and earlier
>
>    l1= set([3, 4, 7, 2])
>    l2 = set([2, 3])
>    l2 = set([2, 3, 99])
>    print l1 & l2

Thanks Paul, but:

bosui:~> python
Python 2.2.3 (#1, Oct 26 2003, 11:49:53)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-20)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sets import Set as set
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named sets




More information about the Python-list mailing list