为什么空格被视为语法错误?

Ped*_*ian 1 python syntax-error

我正在使用Python 3.1 IDLE并且发现空格(我将这样标记为_)被IDLE强调为语法错误.我想知道是否有人知道问题所在并提供解决方案.我知道它看起来不对,但下划线就是要强调IDLE说问题所在.我无法弄清楚该行和下一行的问题是什么.

    def attrSelection():
        while attrChoice!=6
            if attrChoice==1:
                attrChoice=Power
                baseAttr=int(basePow)
                attrEditor()
     _      elif attrChoice==2:
                attrChoice=Health
                baseAttr=int(baseHlth)
                attrEditor()
            elif attrChoice==3
                attrChoice=Wisdom
                baseAttr=int(baseWis)
                attrEditor()
            elif attrChoice==4:
                attrChoice=Dexterity
                baseAttr=int(baseDex)
                attrEditor()
            elif attrChoice==5:
                assignRandom()
            else:
                print('Option does not exist.  Please enter option in range 1-6.')
                attrChoice=input('Choice: ')
Run Code Online (Sandbox Code Playgroud)

小智 5

IDE可能会向您指出错误:

def attrSelection():
    while attrChoice!=6
    ...
        elif attrChoice==3
    ...
Run Code Online (Sandbox Code Playgroud)

:之后你错过了.否则,一切看起来都很好,假设您在列出代码时没有错过开头的缩进.63