随笔分类 - python练习
摘要:一:定义一个学生类。有下面的类属性: 1 姓名(name) 例如 张三 2 年龄(age) 例如 20 3 成绩(score) 例如 {'chinese':80, 'math':90, 'english':70} 类方法: 1 获取学生的姓名: get_name() 2 获取学生的年龄: get_age() 3 返回3门科目中最高的分数。 get_course() 写好类以后,可以定义...
阅读全文
摘要:1 import json 2 import os 3 4 5 class DataToDB(): 6 7 def readData(self): 8 if os.path.exists('data.txt'): 9 with open('data.txt', 'r+', encoding='utf-8') as fp: 1...
阅读全文

浙公网安备 33010602011771号