This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
通过在
True
和False
之后放置括号,您可以向解释器发出信号,表明您正在尝试像函数一样调用它们。只需删除括号,您就可以开始了。事实上,您通常不必检查布尔值的相等或不相等。您只需将变量作为
if
或elif
的条件,Python 就会理解您的意思。By putting the parenthesis after
True
andFalse
, you're signalling to the interpreter that you're trying to call them like a function. Just remove the parenthesis, and you should be good to go.In fact, you usually don't have to check equality or inequality for Boolean values. You can just put the variable as the condition to the
if
orelif
and Python will understand what you meant.