2024-09-27 22:26:45 发布
网友
执行下面的代码时,出现语法错误:
expected an indented block
我已经检查了标签不是像其他线程建议的空格。是什么造成的?在
if wallDirection = '-X': xAxis = -buildingSectionWidth
首先看What is the difference between an expression and a statement in Python?,if语句需要一个表达式作为其条件。在
if
wallDirection = '-X'是一个语句,它将wallDirection分配给值-X。这里可能需要的表达式是wallDirection == '-X'。测试相等性的运算符是==,而不是{}。在
wallDirection = '-X'
wallDirection
-X
wallDirection == '-X'
==
if wallDirection == '-X': xAxis = -buildingSectionWidth
首先看What is the difference between an expression and a statement in Python?,
if
语句需要一个表达式作为其条件。在wallDirection = '-X'
是一个语句,它将wallDirection
分配给值-X
。这里可能需要的表达式是wallDirection == '-X'
。测试相等性的运算符是==
,而不是{相关问题 更多 >
编程相关推荐