def genTeachReport(self):
'''
Creates a CSV file with name, loginID, and group scores for each student in
app_data fullGBook. Headers are included.
'''
csvOut = []
heads = ['name','login_ID',]
for i in self.app_data['fullGBook'][0]['results']:
heads.append(i['title'])
for i in self.app_data['fullGBook']:
toAdd = []
toAdd.append(i['name'])
toAdd.append(i['login_id'])
for k in i['results']:
for j in heads:
if j == k['title']:
toAdd.append(k['mean'])
csvOut.append(toAdd)
with open('StandardsReport.csv', 'w', newline='') as csvfile:
writeOut = csv.writer(csvfile, delimiter=',',dialect='excel')
writeOut.writerow(heads)
for i in csvOut:
writeOut.writerow(i)
messagebox.showinfo(title='Export', message='Data exported to CSV')
评论列表
文章目录