School Result Processing Program-Python Code
School Result processing is one such task for all the CBSE Teachers that take ours and we have to do this boring task every year. The task involve the segregation of the marks scored by the student in each subject as well as other boring stuff like how many students scored more than 90% marks in total or in each subject like this.
This type of task not only boring but also takes lots of time of computer Teachers. Once Bill Gates said ” I assign the most challeging task to the most lazy person and I am sure he will find out some way to do it in an easy way“. The same here.
We have developed a small Python program for automating the boring stuff. This result processing program written in python takes your result file( CSV File ) and convert CBSE school wise result file in an easy to understand and manipulate Excel File.
Here is the python program to process CBSE result.
import csv+ import xlwt from tabulate import tabulate import re def writecell(ws,sub,marks,row): try: subject = int(sub) if(subject ==301): #english ws.write(row,2,int(marks)) if(subject==302): #hindi ws.write(row,3,int(marks)) if(subject==41): #maths ws.write(row,4,int(marks)) if(subject==42): #physics ws.write(row,5,int(marks)) if(subject==43): #chemistry ws.write(row,6,int(marks)) if(subject==83): # computer sciecen ws.write(row,7,int(marks)) if(subject==65): #informatics practices ws.write(row,8,int(marks)) if(subject==44): # Biology ws.write(row,9,int(marks)) if(subject==48): # physical education ws.write(row,10,int(marks)) if(subject==30): #30 - economics ws.write(row,11,int(marks)) if(subject==55): #55 - accounts ws.write(row,12,int(marks)) if(subject==54): #54 - Business studies ws.write(row,13,int(marks)) if(subject==783): #783 - marketing ws.write(row,14,int(marks)) if(subject==28): #28 - Pol Science ws.write(row,15,int(marks)) if(subject==34): #34 - Hindi Vocal Music ws.write(row,16,int(marks)) if(subject==49): #30 - painting ws.write(row,17,int(marks)) if(subject==74): #30 - painting ws.write(row,18,int(marks)) except: return with open('result.csv','r') as csvfile: csv_reader = csv.reader(csvfile) wb = xlwt.Workbook() ws = wb.add_sheet("result") ws.write(0,0,"Roll No") ws.write(0,1,"Student Name") ws.write(0,2,"Eng") ws.write(0,3,"Hindi") ws.write(0,4,"Maths") ws.write(0,5,"Physics") ws.write(0,6,"Chemistry") ws.write(0,7,"CS") ws.write(0,8,"IP") ws.write(0,9,"Bio") ws.write(0,10,"Physical") ws.write(0,11,"Eco") ws.write(0,12,"Account") ws.write(0,13,"BS") ws.write(0,14,"Marketing") ws.write(0,15,"Political") ws.write(0,16,"Music") ws.write(0,17,"painting") ws.write(0,18,"Legal Studies") i=1 for line in csv_reader: line1 = ''.join(line) line2 = re.sub(' +',' ',line1) line3 = line2.split(' ') # print(line3) # print(line3,line3,line3,line3,line3,line3,line3,line3,line3,line3,line3,line3,line3,line3,line3) # # for i in line3: # # print(i, end=" ") # # print(); ws.write(i,0,line3) ws.write(i,1,line3+' '+line3) writecell(ws,line3,line3,i) writecell(ws,line3,line3,i) writecell(ws,line3,line3,i) writecell(ws,line3,line3,i) writecell(ws,line3,line3,i) writecell(ws,line3,line3,i) # print(type(line3),line3) # if int(line3)==301: # ws.write(i,2,int(line3)) # if int(line3)==302: # ws.write(i,3,int(line3)) i+=1 wb.save("result.xls") print("\n\n\nExcel sheet Generated.....Please check results\n\n\n")
The program is able to process the most common 17 subjects. You can edit this Python Program to suite your result.
Pr-requisite for running result Processing Python Software
The main ingredient of this software is your school result that CBSE forward you in Text Format. You are required to maintain your Text File in the following format.
- Remove Extra school information that appear after every 25 rows.
- The second restriction is – All your student name must be of Two words Longs ie first name and second Name. For Example if your student name is :- Ramesh Kumr Mishra then cut short this name into ramesh mishra. The same way if someone only writes Samraddhi then Convert it into Samraddhi Z.
- Replace all the FT( fail in theory) with double space.
- Now save this Text file as result.csv Do not convert this file using any other software in CSV file just change the extension
- Save this result.csv file in the same folder where the python program is stored. Download Sample result.csv File
How to run Result Processing Python Program
- This result processing software need a CSV file that contains the actual result of your school. The name of this csv file is ‘result.csv’ file. You are requested to either change the name of your result file as ‘result.csv’ or change the name of your CSV file in this Python Program.
- This Python Program need two Python modules – 1. csv 2. Xwlt . First Python module is responsible for processing your CSV file and the second Python Module xwlt is required to write your desired data in Excel sheet.
- The name of your Excel Book is ‘result.xls”
- You are required to copy your CSV file in the same folder where this program in saved in your disk.
- The resultant Excel file will be stored in the same folder.
Final Thoughts on Result Processing Program
Though the program is able to convert your Text File ( stored in CSV format) into excel file but it is not able to calculate other vital information like how many scored more than 75% marks etc etc. Here you are required to use basic excel formulas.
Hope you would like this result processing program, We are trying to improve its functionality, If you want to contribute in this program, Do not hesitate to contact us.