这句话怎么理解呀
if 里面的not 是和if在一起还是和 1+1==y在一起{:10_282:} 本帖最后由 lumber2388779 于 2017-3-27 09:38 编辑看下逻辑运算符的优先级就可以知道了
参考下http://www.runoob.com/python3/python3-basic-operators.html
not优先级大于and 大于or
加上括号就是 if ((not (1+ (1 ==y))) or ((x == 4) and (7 == 8)) not应该是先进行运算的吧,((not 1)+1==y )or (x==4)and(7==8) 本帖最后由 lumber2388779 于 2017-3-27 09:38 编辑
俊哥儿 发表于 2017-3-27 09:31
not应该是先进行运算的吧,((not 1)+1==y )or (x==4)and(7==8)
0 0刚才看错了- -抱歉 但是 == 和+-*/优先级大于 not先计算 == 的
页:
[1]