我的代码可以在IDLE中运行,但不能在崇高的文字3中运行(IndentationError)

时间:2019-01-27 01:51:43

标签: python-3.x

该代码可以在空闲状态下运行,但是在sublime text3中,有很多IndentationErrors

我检查了“制表符”和“空格”是否正确(制表符之间没有空格) 并且我还更改了sublime text3(“ draw_white_space”:“ all”)中的设置

仍然不起作用

def check():
    symbols = r'''`!@#$%^&*()_+-=/*{}[]\|'";:/?,.<>'''
    chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    nums = '0123456789'
    password = input('please enter the password\n')
    pass_len = len(password)

    while password.isspace() or pass_len == 0:
        password = input('your password is null or include space, please try again\n')

    if pass_len >= 16:
        len_flag = 3
    elif pass_len > 8:
        len_flag = 2
    else:
        len_flag = 1

    str_flag = 0
    for each in password:
        if each in symbols:
            str_flag += 1
            break

    for each in password:
        if each in chars:
            str_flag += 1
            break   

    for each in password:
        if each in nums:
            str_flag += 1
            break

    if len_flag == 1 or str_flag == 1:
        print('low')
    elif len_flag == 2 or str_flag == 2:
        print('medium')
    else:
        print('high')

谁能告诉我下一次发生的事情以及如何避免。非常感谢

0 个答案:

没有答案