简体   繁体   English

Python:-“ if(true)”是什么意思

[英]Python:- what is meaning of “if(true)”

I am trying to debug current code and I am new in python, Need to understand below code Why they use this code and Whats use of this code in python 我正在尝试调试当前代码,并且是python的新手,需要了解以下代码,为什么他们使用此代码以及python中此代码的用途是什么

def _init_():
  if(true):

Before figuring out what if(True) does, think of if(False) first. 在弄清楚if(True)做什么之前,请先考虑if(False) if(False) is actually a commonly used idiom which has the same effect as commenting out multiple lines - all the code that's in its indentation block will not be executed since the condition is always evaluated as false. if(False)实际上是一种常用的成语,其作用与注释多行相同-缩进块中的所有代码都不会执行,因为条件始终被评估为false。 Later, if you want those lines of code below if(False) to be executed again, you can simply change False to True - that's how if(True) comes in. Itself doesn't do anything, it is its opposite if(False) that is useful. 以后,如果您希望再次执行if(False)下面的那些代码行, if(False)可以将False更改为True-这就是if(True)输入方式。它本身不执行任何操作,与if(False)相反if(False) ,这很有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM