有人能告诉我是什么导致了意外的缩进/预期的缩进错误吗?我不太明白,所以帮个忙就好了
print """77
"""
print '1. Go out through the door'
print '2. Stay in the room and find more clues'
option = raw_input('Which Option? ')
break
if option == "1":
print """You attempt to open the door, but it is locked. After a few minutes of hopeless knob-turning, you finally give up. What do you do?
"""
print '1. Stay in the room and find more clues'
print '2. Attempt to use force to break the door'
cluedoor = raw_input('Which Option? ')
break
if option == "2":
print """test123
"""
print '1. Inspect the Rusted Cabinet'
print '2. Go out in to the hallway'
labhall = raw_input('Which Option? ')
if labhall == "1":
print '222'
if labhall == "2":
print '2'
if cluedoor == "1":
break
test = raw_input("test")
break
语句在if
块下是无效的(除非您发布的代码也在[for
或while
]循环中(在这种情况下,您也应该发布所有代码)。如果您想让程序在任何时候继续,请使用pass
。在你想发生什么
if cluedoor == "1":
?在然后您将在该条件语句下编写语句:
“IndentationError”意味着解释器没有在预期的时候找到缩进(例如,在})之后,或者在不需要的时候找到缩进。在
for
或{要解决问题,请替换:
有:
^{pr2}$但是请注意,
cluedoor
没有在执行if
语句的部分中定义。通过一些重新排列,代码可以执行:相关问题 更多 >
编程相关推荐