标签:table val 大于等于 元素 逻辑 div border enter 逻辑判断
表达式 | 描述 |
a == b | a等于b |
a != b | a不等于b |
a > b | a大于b |
a >= b | a大于等于b |
a is b | a和b 是同一个对象 |
a is not b | a和b不是同一个对象 |
a in A | a在A中 |
a not in A | a不在A中 |
假(False) | 真(TRUE) |
False | True |
None | not None |
0 | not 0 |
‘‘(空) | not ‘‘ |
[](空字典) | 字典中有元素 |
()(空元组) | 元组中有元素 |
{}(空字典) | 字典中有元素 |
set() | 集合中有元素 |
>>> condition= False
>>> print (‘True‘) if condition else print( ‘False‘)
False
>>> condition= True
>>> print (‘True‘) if condition else print( ‘False‘)
True
>>> condition= None
>>> print (‘True‘) if condition else print( ‘False‘)
False
>>> condition= 2
>>> print (‘True‘) if condition else print( ‘False‘)
True
>>> condition= 0
>>> print (‘True‘) if condition else print( ‘False‘)
False
>>> condition= 2
>>> print (‘True‘) if condition else print( ‘False‘)
True
>>> condition=‘‘
>>> print (‘True‘) if condition else print( ‘False‘)
False
>>> condition=‘test‘
>>> print (‘True‘) if condition else print( ‘False‘)
True
>>> condition= []
>>> print (‘True‘) if condition else print( ‘False‘)
False
>>> condition= [2]
>>> print (‘True‘) if condition else print( ‘False‘)
True
>>> condition= ()
>>> print (‘True‘) if condition else print( ‘False‘)
False
>>> condition= (2)
>>> print (‘True‘) if condition else print( ‘False‘)
True
>>> condition= {}
>>> print (‘True‘) if condition else print( ‘False‘)
False
>>> condition= {‘key‘:‘value‘}
>>> print (‘True‘) if condition else print( ‘False‘)
True
>>> condition= {}
>>> print (‘True‘) if condition else print( ‘False‘)
False
>>> condition= {‘key‘,‘value‘}
>>> print (‘True‘) if condition else print( ‘False‘)
True
>>> condition= set()
>>> print (‘True‘) if condition else print( ‘False‘)
False
>>> condition= set([‘key‘,‘value‘])
>>> print (‘True‘) if condition else print( ‘False‘)
True
标签:table val 大于等于 元素 逻辑 div border enter 逻辑判断
原文地址:https://www.cnblogs.com/qianslup/p/11119009.html