Python中的布尔操作符

2026-02-17 20:11:31

1、与:and

Python中的布尔操作符

2、或:or,优先级最低。

Python中的布尔操作符

3、非:not,优先级最高。

Python中的布尔操作符

4、比较和布尔操作符混合使用:

比较操作符求值为布尔型,那么就可以与布尔操作符在表达式中使用。

Python中的布尔操作符

猜你喜欢