def main(): c = raw_input("0:退出\n1:选课\n2:退课\n3:查询已选课程\n4:根据课程名查看选课学生等") course = make_str_list() # print course course = make_course(course) students = make_student(make_str_list_of_student(read_student('student'))) if c == '1': x = choose_course(student1, course) if x: x = str(int(x) - 1) update_course(course, student1, x, c) # 更新课程的文件 update_student(course[int(x)], students, student_weizhi, c) main() elif c == '2': x = delete_course(student1, course) if x: x = str(int(x) - 1) update_course(course, student1, x, c) update_student(course[int(x)], students, student_weizhi, c) main() elif c == '3': print "您已经选了如下课程:" for i in student1.course: print '课' + str(i) main() elif c == '4': course_name = raw_input("请输入课程名: 如'课1'") print course_name for i in course: # print i.name if i.name == course_name: course1 = i # print i print '人数上限:' + course1.num_of_class print '现在已选人数:' + course1.now_num_of_student print '学生:' + str(course1.student_list) print '教室:' + course1.classroom print '上课时间:' + str(course1.time) print '上课时间:' + time(str(course1.time)) # print '老师:' + course1.teachername main() elif c == '0': pass
def main(): c = raw_input("0:退出\n1:选课\n2:退课\n3:查询已选课程\n4:根据课程名查看选课学生等") course = make_str_list() # print course course = make_course(course) students = make_student(make_str_list_of_student(read_student('student'))) if c == '1': x = choose_course(student1, course) if x: x = str(int(x) - 1) update_course(course, student1, x, c) # 更新课程的文件 update_student(course[int(x)], students, student_weizhi, c) main() elif c == '2': x = delete_course(student1, course) if x: x = str(int(x) - 1) update_course(course, student1, x, c) update_student(course[int(x)], students, student_weizhi, c) main() elif c == '3': print "您已经选了如下课程:" for i in student1.course: print '课'+str(i) main() elif c == '4': course_name = raw_input("请输入课程名: 如'课1'") print course_name for i in course: # print i.name if i.name == course_name: course1 = i # print i print '人数上限:' + course1.num_of_class print '现在已选人数:' + course1.now_num_of_student print '学生:' + str(course1.student_list) print '教室:' + course1.classroom print '上课时间:' + str(course1.time) print '上课时间:' + time(str(course1.time)) # print '老师:' + course1.teachername main() elif c == '0': pass
print '教室:' + course1.classroom print '上课时间:' + str(course1.time) print '上课时间:' + time(str(course1.time)) # print '老师:' + course1.teachername main() elif c == '0': pass def time(str_of_time): return "星期"+str_of_time[1]+' '+str_of_time[0]+str(int(str_of_time[0])+1)+"节课"\ "星期"+str_of_time[3]+' '+str_of_time[2]+str(int(str_of_time[2])+1)+"节课" if __name__ == '__main__': while not login(): if login(): break students = make_student(make_str_list_of_student( read_student('student'))) # 读出格式合理的student, 这里生成了全部的学生 student_weizhi = 0 # 其实没必要. 但为了方便 for i in students: if i.num == stnum: student1 = i break student_weizhi += 1 # print student_weizhi main() # print student1.name # student1 = Student(stnum, '孔令星', '1', '火星科技与技术', [])
print '上课时间:' + str(course1.time) print '上课时间:' + time(str(course1.time)) # print '老师:' + course1.teachername main() elif c == '0': pass def time(str_of_time): return "星期"+str_of_time[1]+' '+str_of_time[0]+str(int(str_of_time[0])+1)+"节课"\ "星期"+str_of_time[3]+' '+str_of_time[2]+str(int(str_of_time[2])+1)+"节课" if __name__ == '__main__': while not login(): if login(): break students = make_student(make_str_list_of_student(read_student('student'))) # 读出格式合理的student, 这里生成了全部的学生 student_weizhi = 0 # 其实没必要. 但为了方便 for i in students: if i.num == stnum: student1 = i break student_weizhi += 1 # print student_weizhi main() # print student1.name # student1 = Student(stnum, '孔令星', '1', '火星科技与技术', [])