- 博客(1)
- 收藏
- 关注
原创 python逻辑运算符优先级
not 1 or 0 and 1 or 3 and 4 or 5 and 6 or 7 and 8 and 9 答案是:4 not or and 的优先级是不同的:not > and > or 我们按照优先级给它们加上括号:(not 1) or (0 and 1) or (3 and 4) or (5 and 6) or (7 and 8 and 9) == 0 or 0 or 4 or 6 or 9 == 4 为啥是 4? “短路逻辑” :3 and 4 == 4,而 3 or 4 == 3。
2020-08-05 21:45:19
699
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人