空白线上出乎意料的Unindent

时间:2014-02-01 23:54:28

标签: python-2.7

def start ():
    print '''Welcome to my game'''
    prompt_1 ()




def prompt_1 ():
    prompt_0 = raw_input('Type a command: ')
    try:
        if prompt_0 == 'go':
            outside_cave ()
        elif prompt_0 == 'help':
            print 'Type "go" to proceed!'
            print
            prompt_1 ()
        else:
            print '...'
            print
            prompt_1 ()


start ()

为什么我会在start()

之前的空白行上获得意外的Unindent

我知道没有定义outside_cave(),这是一个片段。

1 个答案:

答案 0 :(得分:1)

您遗漏了excepttry一起使用。 Python Tutorial有一个关于异常处理的优秀部分,它提供了示例和其他有用的信息。

相关问题