一、布尔运算符

1、x and y: if x is false, then x, else  y

2、x or y: if x is false, then y, else x

3、not x: if x is false, then true, else false

 

二、运算结果

>>> 'a' and 'b'
'b'

>>> '' and 'b'
''

>>> 'a' or 'b'
'a'

>>> '' or 'b'
'b'

>>> not 'a'
False

>>> not ''
True

 

相关文章:

  • 2022-12-23
  • 2021-11-05
  • 2021-12-29
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2021-09-30
猜你喜欢
  • 2022-12-23
  • 2021-07-12
  • 2021-06-08
  • 2022-12-23
  • 2022-12-23
  • 2022-02-11
  • 2021-07-21
相关资源
相似解决方案