c.execute("SELECT * FROM Student WHERE Forename =:forename AND Surname =:surname AND YearGroup =:yeargroup AND FormNumber =:formnumber BETWEEN :startdate AND :enddate", {"forename": forename, "surname": surname, "yeargroup": yeargroup, "formnumber": formnumber, "startdate": startdate, "enddate": enddate})
studentRequest = c.fetchall()
records = studentRequest
#write to file
f = open('Student Report', 'w')
f.write(name)
f.write(' Form Number: ' + (yeargroup +'/'+ formnumber))
f.write(str(records))
f.close()
这是我的代码,但似乎没有将数据从数据库写入文件。虽然写了论坛号等名称。
有人可以帮忙吗?