Skip to content

Instantly share code, notes, and snippets.

@VladSem
Created February 24, 2016 04:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VladSem/fc950136f7d3744c1731 to your computer and use it in GitHub Desktop.
Save VladSem/fc950136f7d3744c1731 to your computer and use it in GitHub Desktop.
True and False in Python
values = [None, 0, "", False, [], {}, "0", True]
for v in values:
if v:
print("True value: {}".format(v))
else:
print("False value: {}".format(v))
# False value: None
# False value: 0
# False value:
# False value: False
# False value: []
# False value: {}
# True value: 0
# True value: True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment