def show_student(self): stu = [] teacher = rw.read('%s%s' % (config.teacher, self)) for i in teacher['classes']: c = rw.read('%s%s' % (config.classes, i)) stu += c['student'] print('现有学生%s' % stu)
def show_teacher(self): print('---查看讲师---') name = input("输入查看讲师名:").strip() if os.path.exists('%s%s' % (config.teacher, name)): teacher = rw.read('%s%s' % (config.teacher, name)) print('讲师名:%s 所教班级%s' % (teacher['name'], teacher['classes'])) else: print('讲师名输入有误!')
def choice_classes(self): classes_name = input('请输入班级名:') if os.path.exists('%s%s' % (config.classes, classes_name)): # 老师信息写入班级 classes = rw.read('%s%s' % (config.classes, classes_name)) if not classes['teacher']: classes['teacher'] = self rw.write('%s%s' % (config.classes, classes_name), classes) # 班级信息写入老师表 teacher = rw.read('%s%s' % (config.teacher, self)) teacher['classes'].append(classes_name) rw.write('%s%s' % (config.teacher, self), teacher) else: print("班级已有老师!") else: print('无此班级!')
def show_student(self): print('---查看学生---') name = input("输入查看学生名:").strip() if os.path.exists('%s%s' % (config.student, name)): student = rw.read('%s%s' % (config.student, name)) print('学生名:%s 班级%s 缴费信息%s' % (student['name'], student['classes'], student['pay'])) else: print('姓名输入有误!')
def show_classes(self): print('---查看班级---') # 打开文件 name = input("输入查看班级名:").strip() if os.path.exists('%s%s' % (config.classes, name)): classes = rw.read('%s%s' % (config.classes, name)) print('班级名:%s 所在地%s 老师%s' % (classes['name'], classes['area'], classes['teacher'])) else: print('课程名输入有误!')
def show_course(self): print('---查看科目---') # 打开course文件,展示 name = input("输入查看课程名:").strip() if os.path.exists('%s%s' % (config.course, name)): course = rw.read('%s%s' % (config.course, name)) print('课程名:%s 周期%s个月 价格%s' % (course['name'], course['period'], course['price'])) else: print('课程名输入有误!')
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(BASE_DIR) from core import rw userinfo = BASE_DIR + '/db/userinfo' teacher = BASE_DIR + '/db/teacher/' student = BASE_DIR + '/db/student/' course = BASE_DIR + '/db/course/' classes = BASE_DIR + '/db/classes/' user_dic = rw.read(userinfo) # user_dic["classes"].pop() # # del user_dic['fan'] # rw.write(student + 's1', user_dic)
def show(self): teacher = rw.read('%s%s' % (config.teacher, self)) print('讲师名:%s 所教班级%s' % (teacher['name'], teacher['classes']))
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(BASE_DIR) from conf import config from core import rw, manager, teacher, student # 定义用户字典和功能字典 user_dic = rw.read(config.userinfo) admin_actions = { '1': manager.Manager.create_teacher, '2': manager.Manager.create_student, '3': manager.Manager.create_course, '4': manager.Manager.create_classes, '5': manager.Manager.boundclass, '6': manager.Manager.show_teacher, '7': manager.Manager.show_student, '8': manager.Manager.show_course, '9': manager.Manager.show_classes } teacher_actions = { '1': teacher.Teacher.show, '2': teacher.Teacher.choice_classes, '3': teacher.Teacher.show_student } student_actions = { '1': student.Student.show, '2': student.Student.choice_classes, '3': student.Student.pay