小编Jam*_*nch的帖子

SyntaxError:在使用if时使用缩进块,在使用空块时使用elif

显然我的代码有问题.当我使用Python 3.3.3 Shell运行以下模块时,我收到错误SyntaxError: expected an indented block.然后IDLE突出显示elif在第7行.

def user_input():
    print('[1]: ASCII to Binary')
    print('[2]: Binary to ASCII')
    user_input = input('Please choose [1] or [2]: ')
    if user_input == ('1', '[1]'):
        #
    elif user_input == ('2', '[2]'):
        #
    else:
        print('Please enter a valid input...')
        user_input()
Run Code Online (Sandbox Code Playgroud)

python shell python-idle

1
推荐指数
1
解决办法
9346
查看次数

标签 统计

python ×1

python-idle ×1

shell ×1