下面是完整的学生成绩管理系统的 Python 代码:
```python import csv
学生成绩类
class Student: def init(self, term, student_id, class_name, name, chinese, math, english, python): self.term = term self.student_id = student_id self.class_name = class_name self.name = name self.chinese = chinese self.math = math self.english = english self.python = python self.total_score = chinese + math + english + python self.average_score = self.total_score / 4
创建信息并以磁盘文件保存
def create_info_and_save(students): with open('student_info.csv', 'w', newline='') as csvfile: fieldnames = ['term', 'student_id', 'class_name', 'name', 'chinese', 'math', 'english', 'python']