Last active
December 13, 2018 11:20
-
-
Save devhero/2aa9613bc817221167d4a8865fa7f97e to your computer and use it in GitHub Desktop.
How to check if all elements of a list matches a condition? - http://stackoverflow.com/questions/10666163/how-to-check-if-all-elements-of-a-list-matches-a-condition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# every item | |
all(item.prop == '' for item in items) | |
# at least one item | |
any(item.prop == '' for item in items) | |
# any item of a is in b | |
any(any(x==y for y in b) for x in a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment