def select_18(): grade_list = [] b_grade = grade_table.Select1(18) for i in b_grade: grade_list.append(i['cxsj2_grade']) print(grade_list) grade = np.zeros(101) for i in range(-1, 101): grade[i] = grade_list.count(str(i)) #print(grade) i = np.arange(-1, 101, 1) plt.plot(i, grade[i], 'y') plt.show()
def select_1(): # 注意字符串和整数转换 grade_list = [] # 存有所有人 dw1_grade 的列表 b_grade = grade_table.Select1(1) for i in b_grade: grade_list.append(i['dw1_grade']) # i 是 b_dw1 字典中的每一行 print(grade_list) grade = np.zeros(101) # 考 i 分的有 grade[i] 人 for i in range(-1, 101): grade[i] = grade_list.count(str(i)) #print(grade) i = np.arange(-1, 101, 1) plt.plot(i, grade[i], 'r-') plt.show()