Skip to content

Instantly share code, notes, and snippets.

@ugursogukpinar
Created May 19, 2015 11:43
Show Gist options
  • Save ugursogukpinar/24c52d0cc50eed419337 to your computer and use it in GitHub Desktop.
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
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