Thursday 26 November 2020

Check if all elements of one array is in another array

 

issubset should help you

set(B).issubset(set(A))

e.g.:

>>> A= [1,2,3,4]
>>> B= [2,3]
>>> set(B).issubset(set(A))
True

from : https://stackoverflow.com/questions/20789412/check-if-all-elements-of-one-array-is-in-another-array

No comments:

Post a Comment