Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check a list contained by another list without a loop?

Tags:

Is there any builtins to check if a list is contained inside another list without doing any loop?

I looked for that in dir(list) but found nothing useful.

like image 619
Young Avatar asked Apr 06 '10 05:04

Young


People also ask

Is a list within another list is possible?

List within another list either order list or unordered list is called nested list.


1 Answers

Depends on what you mean by "contained". Maybe this:

if set(a) <= set(b):     print("a is in b") 
like image 172
nosklo Avatar answered Nov 04 '22 12:11

nosklo