 <p>Note: its not a tested code. but it tries to solve your problem. Please give it a try</p> <pre><code>import csv with open(file_name, 'rb') as csvfile: marksReader = csv.reader(csvfile) for row in marksReader: if len(row) &lt; 8: # 8 is the number of columns in your file. # row has some missing columns or empty continue # Unpack columns of row; you can also do like fname = row[0] and lname = row[1] and so on ... (fname,lname,subj1,marks1,subj2,marks2,subj3,marks3) = *row # you can use float in place of int if marks contains decimals totalMarks = int(marks1) + int(marks2) + int(marks3) print '%s %s scored: %s'%(fname, lname, totalMarks) print 'End.' </code></pre>