<br>Check out collections.Counter if you have 2.7 or up.<br><br>If you don't, google for multiset or bag types.<br><br><div class="gmail_quote">On Mon, Aug 15, 2011 at 4:26 PM, Johannes <span dir="ltr"><<a href="mailto:dajo.mail@web.de">dajo.mail@web.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">hi list,<br>
what is the best way to check if a given list (lets call it l1) is<br>
totally contained in a second list (l2)?<br>
<br>
for example:<br>
l1 = [1,2], l2 = [1,2,3,4,5] -> l1 is contained in l2<br>
l1 = [1,2,2,], l2 = [1,2,3,4,5] -> l1 is not contained in l2<br>
l1 = [1,2,3], l2 = [1,3,5,7] -> l1 is not contained in l2<br>
<br>
my problem is the second example, which makes it impossible to work with<br>
sets insteads of lists. But something like set.issubset for lists would<br>
be nice.<br>
<br>
greatz Johannes<br>
<font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>