本文介绍了这个&"if&"是什么意思?声明是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在一个示例Hadoop reduce程序中,存在这样的"if"语句.我想知道什么时候相同的变量"a"在"if"语句中两次使用,如下所示:
如果a和a == b:打印正在运行!" 解决方案仅当 a 为真时,才会测试是否相等( a == b ).
可以改写为
如果是:如果a == b:print(正在工作!")请注意运算符的优先级: 不 等于 if(a and a)== b .
In an example Hadoop reduce program, such an "if" statement exists. I am wondering what it means when the same variable "a" is used twice in the "if" statement, as follows
if a and a == b: print "It is working!"解决方案
It will test for equality (a == b) only if a is truthy.
It can be rewritten as
if a: if a == b: print("It is working!")Note the operator precedence: it's not equal to if (a and a) == b.
更多推荐
这个&"if&"是什么意思?声明是什么意思?
发布评论