Created
May 19, 2015 11:43
-
-
Save ugursogukpinar/24c52d0cc50eed419337 to your computer and use it in GitHub Desktop.
Best way to check is not None each element of an array in Python
This file contains 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
lst = [1,2,3] | |
if all(v is not None for v in lst): | |
print "This will print" | |
lst = [1, None, 3] | |
if all(v is not None for v in lst): | |
print "This won't print" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment