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

Splitting python path using os.path module

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

To speed up accessing files on nfs shares on a ubuntu machine ...