True/False value testing

ast nomail at invalid.com
Thu Jan 7 05:36:11 EST 2016


Hello

For integer, 0 is considered False and any other value True

>>> A=0
>>> A==False
True
>>> A==True
False
>>> A=1
>>> A==False
False
>>> A==True
True

It works fine

For string, "" is considered False and any other value True,
but it doesn't work

>>> A = ""
>>> A==False
False
>>> A==True
False
>>> A = 'Z'
>>> A==False
False
>>> A==True
False


What happens ???

thx




More information about the Python-list mailing list