class Student:
def __init__(self, id, name, sex):
self.id = id
self.name = name
self.sex = sex
class StudentManagement:
def __init__(self):
self.stu_list = []
def addStudent(self, stu):
self.stu_list.append(stu)
print('学号: {0}, 姓名: {1}, 性别: {2}'.format(stu.id, stu.name, stu.sex))
if __name__ == '__main__':
print('添加的学员信息:')
student1 = Student('1001', '张三', '男')
student2 = Student('1002', '莉丝', '女')
student3 = Student('1003', '王武', '男')
student_manager = StudentManagement()
student_manager.addStudent(student1)
student_manager.addStudent(student2)
student_manager.addStudent(student3)