Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #displays average time of all students
- def display_times():
- print('hello')
- all_average_pupils_times=[]
- print(all_average_pupils_times)
- with open('pupil_times.txt', 'rU') as csvfile:
- reader = csv.reader(csvfile)
- for row in reader:
- if (row):
- all_average_pupils_times.append(row)
- print(all_average_pupils_times)
- csvfile.close()
- records =all_averagetime_Tv.get_children()
- for elements in records:
- all_averagetime_Tv.delete(elements)
- for row in all_average_pupils_times :
- all_averagetime_Tv.insert('','end',text=row[0],values=(row[1],row[2]))
- #we are now going to write to a word document
- word = open('All pupil average time .doc','w')
- #we are now going to right each line
- word.write('\t' +'\t' +'\t' +'Average ski time of all students'+'\n'+'\n'+'\n')
- #now we are going to create a for loop and use the variable i to take on the data in each part of the array as the for loop progesses
- for i in all_average_pupils_times:
- #we now write the pupil id and use spaces to space out properly
- word.write('Pupil Id - '+i[0]+'\n')
- #we now write the pupil firstname and use spaces to space out properly
- word.write('Firstname - '+i[1] +'\n')
- #we now write the pupil surname and use spaces to space out properly
- word.write('Surname - '+i[2] +'\n')
- #we now write the pupil Average time and use spaces to space out properly
- word.write('Average time - '+i[2] + ' Seconds'+'\n' )
- #Get the current date
- current_date = datetime.datetime.now()
- print(current_date)
- word.write('Date: '+str(current_date.day) +'/' + str(current_date.month)+'/' + str(current_date.year) +'\n')
- word.write('Time: '+str(current_date.hour)+':'+str(current_date.minute)+str(current_date.second) +'\n' +'\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement