我的 Python 代码在 elif 之后立即抛出一个 expected indented block 错误。
我看不出缩进错误在哪里。
我犯了什么缩进错误?
def expandProcedure(node, queue):
successors = []
n = 4
while (n > 0):
parent = node
depth = node[2] + 1
pathCost = node[3] + 1
newState = testState(node[0], n)
if newState == 0:
## do nothing
elif inQueue(newState[0], queue):
#do nothing
else:
s = makeNode(newState, parent, depth, pathCost)
successors.insert(0, s)
n = n - 1
return successors
请您参考如下方法:
你不能有空 block 。使用pass(非)命令:
if newState == 0:
pass
elif inQueue(newState[0], queue):
pass
