Beispiel #1
0
from college import Student, Group, Teacher

# students = Student.import_from_file('students.src') #статический ход
# [print(el) for el in students]

print('*' * 25)
students_23 = Student.import_from_file('23_group.src')
group_23 = Group('23', 'Прикладная ифнформатика 09.02.05')
group_23.add_students(students_23)
[print(el, el.group) for el in students_23]

print('*' * 25)
students_33 = Student.import_from_file('33_group.src')
group_33 = Group('33', 'Информационные системы и среды 09.02.07')
group_33.add_students(students_33)
[print(el, el.group) for el in students_33]

print('*' * 25)
teachers = Teacher.import_from_file('teachers.src')
[print(el) for el in teachers]
Beispiel #2
0
# group_1 = Group('33', 'Прикладная информатика 09.02.05')
# group_2 = Group('23', 'Прикладная информатика 09.02.05')
# student_1.set_group(group_1)
# student_2.set_group(group_1)
# student_3.set_group(group_1)
# student_4.set_group(group_2)
# student_5.set_group(group_2)
#
# students = [student_1, student_2, student_3, student_4, student_5]
#
# print(f'\nВ мероприятии участвовал:')
# for student in students:
#     print(f'\t{student} ({student.group})')

students_source = open('students.src', 'r', encoding='utf-8').readlines()
students_source = list(map(lambda x: x.replace('\n', '').split(', '), students_source))


students_schema = students_source.pop(0)


students_source_as_dict = list(map(lambda x: dict(zip(students_schema, x)), students_source))


students = []
for student_dict in students_source_as_dict:
    _student = Student(**student_dict)
    students.append(_student)

[print(el) for el in students]