Posted By

dorseye on 08/19/09


Tagged

python boolean truefalse


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

louscomp
gartenstuhl


Boolean and True/False values


 / Published in: Python
 

  1. >>> bool('spam')
  2. True
  3. >>> bool('')
  4. False
  5. >>> bool([])
  6. False
  7. >>> bool({})
  8. False
  9. >>> bool(1)
  10. True
  11. >>> bool(0.0)
  12. False
  13. >>> bool(None)
  14. False

Report this snippet  

You need to login to post a comment.