(input_tip, length)
循环输入选择的序号,直到符合规定为止
循环输入选择的序号,直到符合规定为止
循环输入选择的序号 直到符合规定为止
def loop_input_choice_number(input_tip, length):
    """
    循环输入选择的序号,直到符合规定为止
    """
    while True:
        print("")
        if length >= 10:
            choice = input(input_tip)
        else:
            choice = readchar(input_tip)
        if not choice:
            return
        if choice.isnumeric():
            choice = int(choice)
        else:
            print(ColorStr.red(_("input error, please input again")))
            continue
        if (choice <= length and choice > 0):
            return choice
        else:
            print(ColorStr.red(_("input error, please input again")))
def loop_input_choice_number ( input_tip , length ) : while True : print ( "" ) if length >= 10 : choice = input ( input_tip ) else : choice = readchar ( input_tip ) if not choice : return if choice . isnumeric ( ) : choice = int ( choice ) else : print ( ColorStr . red ( _ ( "input error, please input again" ) ) ) continue if ( choice <= length and choice > 0 ) : return choice else : print ( ColorStr . red ( _ ( "input error, please input again" ) ) )