python中表示False的一些内置对象
By default, an object is considered true unless its class defines either a __bool__() method that returns False or a __len__() method that returns zero, when called with the object. Here are most of the built-in objects considered false:
- constants defined to be false:
NoneandFalse. - zero of any numeric type:
0,0.0,0j,Decimal(0),Fraction(0, 1) - empty sequences and collections:
'',(),[],{},set(),range(0)
posted on 2018-12-04 21:23 JesseChang 阅读(378) 评论(0) 收藏 举报
浙公网安备 33010602011771号