Python Learning

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

Posted by Ryoko at 18:14 No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

About Me

Ryoko
View my complete profile

Blog Archive

  • ►  2022 (25)
    • ►  December (1)
    • ►  November (1)
    • ►  September (7)
    • ►  July (1)
    • ►  June (1)
    • ►  April (2)
    • ►  March (3)
    • ►  February (7)
    • ►  January (2)
  • ►  2021 (35)
    • ►  November (2)
    • ►  October (3)
    • ►  September (4)
    • ►  August (2)
    • ►  July (2)
    • ►  June (3)
    • ►  May (8)
    • ►  April (1)
    • ►  March (5)
    • ►  February (3)
    • ►  January (2)
  • ▼  2020 (106)
    • ►  December (9)
    • ▼  November (1)
      • Check if all elements of one array is in another a...
    • ►  October (3)
    • ►  September (5)
    • ►  August (6)
    • ►  July (9)
    • ►  June (2)
    • ►  May (6)
    • ►  April (27)
    • ►  March (4)
    • ►  February (25)
    • ►  January (9)
Simple theme. Powered by Blogger.