print 'False' if (False) else 'True'
感觉有点类似 C/C++ 中的三目运算符。我在教程中都没有看到过相关的介绍。这是什么语法?
伊谢尔伦2017-04-17 14:29:47
https://docs.python.org/2/reference/expressions.html#conditional-expressions
This is the syntax, just understand it.
怪我咯2017-04-17 14:29:47
print 'False' if (False) else 'True'
That is, if (False) ? printf("False") : printf("True")
in C, JAVA and other languages
if A?B:C converted to python is B if A else C