Empty strings "" and zero 0 are treated as False in python

>>> any ([0, 0])
False
>>> any ([1, 0])
True
>>> any ([None, 0, ""])
False
>>> bool(0)
False
>>> bool("")
False
>>> bool(1)
True

Comments

Popular posts from this blog

Multiple repeat error when the regex has multiple wildcards in python re module

Avoid using global/class-level mutable datatypes like list/dicts

Weakref proxy is for instance only ...