开发者

Python zero-values

Are there any values other than Fa开发者_运维问答lse, None, 0, and 0.0 that will return False with bool(x) (in Python 3.X)?


http://docs.python.org/py3k/library/stdtypes.html#truth-value-testing


Any empty sequence or mapping object will also evaluate to False:

>>> bool({})
False
>>> bool([])
False
>>> bool("")
False
>>> bool(())
False
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜