예제 #1
0
def choose_school():
    while True:
        flag, school_list_or_msg = common_interface.get_all_school_interface()
        if not flag:
            print(school_list_or_msg)
            break

        for index, school_name in enumerate(school_list_or_msg):
            print(f'编号:{index} 学校名:{school_name}')

        choice = input('请输入学校编号').strip()
        if not choice.isdigit():
            print('请输入数字')
            continue
        choice = int(choice)

        if choice not in range(len(school_list_or_msg)):
            print('请输入正确编号')
            continue

        school_name = school_list_or_msg[choice]
        flag, msg = student_interface.choose_school_interface(school_name, student_info['user'])
        if flag:
            print('msg')
            break
        else:
            print('msg')
def choose_school():
    while True:
        school_list = common_interface.get_school_interface()

        for index, school in enumerate(school_list):
            print(index, school)

        choice = input('请输入选择的学校编号:').strip()
        #如果不是数字
        if not choice.isdigit():
            print('必须是数字!')
            continue

        choice = int(choice)

        if choice not in range(len(school_list)):
            print('必须输入正确的学校编号:')
            continue

        school_name = school_list[choice]

        flag, msg = student_interface.choose_school_interface(
            student_info.get('user'), school_name)
        if flag:
            print(msg)
            break

        else:
            print(msg)
            break
예제 #3
0
def choose_school():
    while True:
        print('欢迎来到选择学校界面')

        school_list = common_interface.get_school_list()
        for k, v in enumerate(school_list):
            print(f'{k} {v}')

        school_choice = input('请选择学校,或按q退出>>>').strip()
        if school_choice == 'q':
            break
        if not school_choice.isdigit():
            print('请输入数字')
            continue
        school_choice = int(school_choice)
        if school_choice not in range(len(school_list)):
            print('请输入正确的数字')
            continue
        school_name = school_list[school_choice]
        flag, msg = student_interface.choose_school_interface(
            student_info['user'], school_name)
        if flag:
            print(msg)
            break
        else:
            print(msg)
            break
예제 #4
0
def choose_school():
    print(f'{"*"*13}欢迎来到选择学校功能{"*"*13}')
    while True:
        school_list = common_interface.get_school_interface()
        if not school_list:
            print('没有学校请先创建学校')
            break
        # 2.选择学校
        for index, school in enumerate(school_list):
            print(index, school)
        choice_school = input('请输入学校编号,q退出>')
        if choice_school == 'q':
            break
        if not choice_school.isdigit():
            print('请输入数字')
            continue
        choice_school = int(choice_school)
        if choice_school not in range(len(school_list)):
            print('输入错误!')
            continue
        school_name = school_list[choice_school]
        flag, msg = student_interface.choose_school_interface(
            student_info['username'], school_name)
        if flag:
            print(msg)
            break
        else:
            print(msg)
예제 #5
0
def choose_school():
    print("欢迎来到选择学校界面!".center(30, '*'))
    while True:
        school_list = student_interface.get_all_school('school')
        if not school_list:
            print("没有学校可选!")
            return
        print('=' * 30)
        for index, school in enumerate(school_list):
            print('编号:%s  学校:%s'%(index, school))
        print('=' * 30)
        choice = input("请选择学校编号:")
        if not choice.isdigit():
            print("请输入数字!")
            continue
        choice = int(choice)
        if not (choice >= 0 and choice < len(school_list)):
            print("请输入合法编号!")
            continue
        school_name = school_list[choice]
        flag, msg = student_interface.choose_school_interface(student_info['name'], school_name)
        if flag:
            print(msg)
            break
        else:
            print(msg)
            break
예제 #6
0
def choose_school():
    while True:
        print('---选择学校---')
        # 先打印学校列表
        school_list = common_interface.check_school_interface()
        if not school_list:
            print('学校还没开,请等待')
            break
        # 循环打印
        for index, school_name in enumerate(school_list):
            print(index, school_name)

        choice = input('请输入选择的学校编号(q.退出):').strip()
        if choice == 'q':
            break
        if not choice.isdigit():
            print('输入不规范,重新输入!')
            continue

        choice = int(choice)
        # 判断范围
        if choice not in range(len(school_list)):
            print('输入的不在范围,重新输入!')
            continue
        school_name = school_list[choice]
        # 调用学生中的选择学校接口
        flag, msg = student_interface.choose_school_interface(school_name, student_info['user'])
        if flag:
            print(msg)
            break
        else:
            print(msg)
            continue
예제 #7
0
def choose_school():
    while True:
        flag, school_list = common_interface.get_school_interface()
        if not flag:
            print(school_list)
            break
        else:
            for i, school in enumerate(school_list):
                print(f'{i}:{school}')
            choice = input('选择学校编号:')
            if choice == 'q':
                break
            if not choice.isdigit():
                print('必须是数字 !')
                continue

            choice = int(choice)
            if choice not in range(len(school_list)):
                print('没有这个学校!')
                continue
            school_name = school_list[choice]
            flag, msg = student_interface.choose_school_interface(
                student_info['user'], school_name)
            print(msg)
            break
예제 #8
0
def choose_school():
    print('欢迎选择学校')
    while True:
        username = user_info['username']
        school_list = common_interface.get_list_interface('school')

        if not school_list:
            print('还未创建学校')
            continue

        for i, school in enumerate(school_list):
            print(i, school)

        choice = input('请选择你需要创建课程的学校编号>>>').strip()

        if choice == 'q':
            break

        if not choice.isdigit():
            print('请输入数字')
            continue

        choice = int(choice)

        if choice not in range(len(school_list)):
            print('输入错误')
            continue

        school_name = school_list[choice]
        flag,msg = student_interface.choose_school_interface(username,school_name)
        if flag:
            print(msg)
            break
        else:
            print(msg)
예제 #9
0
def choose_school():
    """
    选择学校
    :return:
    """
    school_list = common_interface.check_all_school()
    print(school_list)
    if not school_list:
        print("请联系管理员创建学校")
        return
    for i, school in enumerate(school_list):
        print("%s:%s" % (i, school))
    choice = input("请选择学校").strip()
    if choice.isdigit():
        choice = int(choice)
        if choice < len(school_list):
            flg, msg = student_interface.choose_school_interface(
                student_info["name"], school_list[choice])
            if flg:
                print(msg)
            else:
                print(msg)
        else:
            print("选择请在范围内")
    else:
        print("请用数字选择学校")
예제 #10
0
def choose_school():
    """
	选择学校
	:return:
	"""
    school_list = common_interface.check_all_file('school')
    if not school_list:
        print('请联系管理员创建学校')
        return
    while True:
        for k, school in enumerate(school_list):
            print('%s: %s' % (k, school))
        choice = input('请选择学校序列号或者输入q退出:').strip()
        if choice == 'q': break
        if choice.strip().isalnum():
            choice = int(choice)
            if choice < len(school_list):
                flag, msg = student_interface.choose_school_interface(
                    student_name['name'], school_list[choice])
                if flag:
                    print(msg)
                    break
                else:
                    print(msg)

            else:
                print('输入非法')
        else:
            print('请输入数字')
예제 #11
0
def choose_school():
    print('选择学校')
    while True:
        school_list=admin_interface.check_all_school()
        if not school_list:
            print('学校不存在')
            return
        for i,school in enumerate(school_list):
            print('%s : %s'%(i,school))
        choo_school=input('请选择学校').strip()
        if choo_school.isdigit():
            choo_school=int(choo_school)
            if choo_school<len(school_list):
                flag,msg=student_interface.choose_school_interface(student_info['name'],school_list[choo_school])
                if flag:
                    print(msg)
                    break
                else:
                    print(msg)
                    continue
            else:
                print('请选择存在的学校')
                continue
        else:
            print('请输入数字')
            continue
예제 #12
0
def choose_school():
    print('欢迎来到选择学校功能')
    username = user_info['username']

    school_list = common.get_obj_list('school')
    for ind, school in enumerate(school_list):
        print(ind, school)

    school_choice = input('请输入你需要选择的学校序号>>>')
    school_name = school_list[int(school_choice)]

    msg = student_interface.choose_school_interface(username, school_name)
    print(msg)
예제 #13
0
def choose_school():
    while True:
        school_list = common_interface.get_school_interface()
        for school in school_list:
            print(school)
        choice = input('请选择学校>>>').strip()
        if choice in school_list:
            school_name = choice
            flag,msg = student_interface.choose_school_interface(student_info['user'],school_name)
            print(msg)
            if flag:
                break
        else:
            print('请选择存在的学校')
            continue
예제 #14
0
파일: student.py 프로젝트: WunschTxT/Python
def choose_school():
    # print('选择学校'.center(40, '-'))
    # while True:
    #     school_list = common_interface.check_all_school()
    #     if school_list:
    #         for i, school in enumerate(school_list):
    #             print(f'{i}:{school}')
    #         choice = input('请选择学校:').strip()
    #         if choice.isdigit():
    #             choice = int(choice)
    #             if choice >= len(school_list):
    #                 continue
    #             state, msg = student_interface.choose_school_interface(student_info['name'], school_list[choice])
    #             if state:
    #                 print(msg)
    #                 break
    #             else:
    #                 print(msg)
    #                 break
    #         else:
    #             print('请输入正确选择!')
    #     else:
    #         print('暂无学校')
    #         break
    print('选择学校'.center(40, '-'))
    while True:
        school_list = common_interface.check_all_school()
        if school_list:
            for i, school in enumerate(school_list):
                print('%s : %s' % (i, school))
            choice = input('请选择(学校):').strip()
            if choice.isdigit():
                choice = int(choice)
                if choice >= len(school_list):
                    continue
                state, msg = student_interface.choose_school_interface(
                    student_info['name'], school_list[choice])
                if state:
                    print(msg)
                    break
                else:
                    print(msg)
                    break
            else:
                print('请输入数字')
        else:
            print('暂无学校')
            break
예제 #15
0
def choose_school():
    while True:
        school_list = common_interface.get_all_school()
        if not school_list:
            break
        for index, school in enumerate(school_list):
            print(index, school)
        choice = input('请输入,q退出')
        if choice == 'q':
            break
        if not choice.isdigit():
            continue
        choice = int(choice)
        school_name = school_list[choice]
        flag, msg = student_interface.choose_school_interface(
            user['username'], school_name)
        print(msg)
예제 #16
0
def choose_school():
    print("choose school")
    school_list = common.check_all_schools()
    if not school_list:
        print("there is no school")
        return
    for i, school in enumerate(school_list):
        print("%s:%s" % (i, school))
    choice = input("please choose school")
    if choice.isdigit():
        choice = int(choice)
        if choice < len(school_list):
            flg, msg = student_interface.choose_school_interface(student_info["name"], school_list[choice])
            print(msg)
        else:
            print("there is no this school")
    else:
        print("please input digit")
예제 #17
0
def choose_school():
    while 1:
        school_list = common_interface.show_all_school()
        for index, school_name in enumerate(school_list):
            print(f"编号:[{index}]        学校名:[{school_name}]")
        school_index = input("请输入选择的学校的编号:[温馨提示:输入q退出]")
        if school_index.lower() == "q":
            break
        if not school_index.isdigit():
            print("请输入数字!")
            continue
        school_index = int(school_index)
        if school_index not in range(len(school_list)):
            print("编号不存在!")
            continue
        school_name = school_list[school_index]
        flag, msg = student_interface.choose_school_interface(
            online_user["name"], school_name)
        print(msg)
        if flag is True:
            break
예제 #18
0
def choose_school():
    while True:
        flag, school_list = common_interface.get_all_school_interface()

        if not flag:
            print(school_list)
            break

        for index, school_name in enumerate(school_list):
            print(f'ID [{index}]  School name [{school_name}]')

        choice = input('Please input School\'s ID(Press q to quit):').strip()

        if choice.lower() == 'q':
            print('Quit success')
            break

        if not choice.isdigit():
            print('Please input number')
            continue

        choice = int(choice)

        if choice not in range(len(school_list)):
            print('Please input correct number')
            continue

        school_name = school_list[choice]

        flag, msg = student_interface.choose_school_interface(
            school_name, student_info.get('user'))

        if flag:
            print(msg)
            break

        else:
            print(msg)
            break
예제 #19
0
def choose_school():
    """
    学生选择学校
    """
    while True:
        # 1 获取学校信息列表
        school_list = common_interface.get_school_list()
        if not school_list:
            print("学校不存在")

        # 2 打印课程信息
        for inex, school in enumerate(school_list):
            print(inex, school)

        # 3 选择学校
        choise = input("请输入学校编号")
        if choise == 'q':
            break

        if not choise.isdigit():
            print("学校不存在")
            continue

        choise = int(choise)
        if choise not in range(len(school_list)):
            print("用户不存在")
            continue

        # 3 选择学校
        school_name = school_list[choise]
        flag, msg = student_interface.choose_school_interface(
            student_info.get('user'), school_name)
        if flag:
            print(msg)
            break
        else:
            print(msg)
            break