这个&"if&"是什么意思?声明是什么意思?

编程入门 行业动态 更新时间:2024-10-09 14:26:28
本文介绍了这个&"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&"是什么意思?声明是什么意思?

本文发布于:2023-05-28 00:48:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/308269.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:词库加载错误:Could not find file 'D:\淘小白 高铁采集器win10\Configuration\Dict_Sto

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!