title: How to load calculation input from text file with Python?
body: <p>I have a text file containing:</p>
  
  <pre><code>Number Name subject1 subject2 subject3 subject4 subject5
  1234567 Jan 5 7 0 6 4
  3526435 Marie 5 5 7 0 0
  2230431 Kees 6 10 0 8 6
  7685433 André 4 7 8 7 5
  0364678 Antoinette 0 2 8 8 8
  1424354 Jerôme 7 9 0 5 0
  4536576 Kamal 8 0 8 7 8
  1256033 Diana 0 0 0 0 0
  5504657 Petra 6 6 7 0 6
  9676575 Malika 0 6 0 0 8
  0253756 Samira 3 8 6 7 10
  </code></pre>
  
  <p>I want to calculate the average grades for each student (if grade = 0 then it is not included), and I want to calculate the average grades for each subject (again, without calculating 0).</p>
  
  <p>In my own code I copied all of the information and put it into lists. </p>
  
  <p>The problem I am facing, is that I need my Python program to read the text file and calculate with the given numbers.</p>
  
  <p>So far, this is all I have:</p>
  
  <pre><code>i = 0
  file = open("resultaten.txt", "r")
  
  for x in file:
      if i == 0:
          print("Lines: ")
  
      else:
          x = x.split()
          print(i, x)
      i +=1
  </code></pre>
  
  <p>How would one use a text file to calculate specific characters in a line?</p>
  
  <p>Thanks in advance.</p>