Python types has boolean value, defined in special methods. in particular, 0
, None
, False
, ""
(and any other empty sequence) are false.
Obviously,
>>> int("0")
0
What's more, the value of False
is 0, and the value of True
is 1, for most purposes (except for their representation as strings, and their type
, which is bool
):
>>> 0 == False
True