9 月 252020
 
>>> #布尔类型的数据只有两种,True和False
>>> #但凡能够产生一个布尔值的表达式称为布尔表达式
>>> 1 > 2
False
>>> 1 < 2 < 3
True
>>> 42 != '42'
True
>>> 'Name' == 'name'
False
>>> 'M' in 'Magic'
True
>>> number = 12
>>> number is 12
<stdin>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
True
>>>
>>> #对于比较运算符,如果比较式成立则返回True,不成立则返回False
>>> #“==”左右两边等值
>>> #“!=”左右两边不相等
>>> #“>”左边大于右边
>>> #“<”左边小于右边
>>> #“<=”左边小于或等于右边
>>> #“>=”左边大于或等于右边

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)