title: Splitting data in file in Python
body: <pre><code>class Student:
  
      def __init__(self, name, hours, qpoints):
          self.name = name
          self.hours = float(hours)
          self.qpoints = float(qpoints)
  
      def getName(self):
          return self.name
  
      def getHours(self):
          return self.hours
  
      def getQPoints(self):
          return self.qpoints
  
      def gpa(self):
          return self.qpoints/self.hours
  
  def makeStudent(infoStr):
  
      name, hours, qpoints = infoStr.split("\t")
  
  
      return Student(name, hours, qpoints)
  
  def main():
      fileName = input("Enter file name: ")
      infile = open(fileName, "r")
  
      best = makeStudent(infile.readline())
  
      for line in infile:
          s = makeStudent(line)
          if s.gpa() &gt; best.gpa():
              best = s
  
      infile.close()
  
      print("The best student is:", best.getName())
      print("hours:", best.getHours())
      print("GPA:", best.gpa())
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>I want to read line from a text file, split it in by "\t" or "," so I can assign it to variables, and I get "ValueError: not enough values to unpack (expected 3, got 1) in makeStudent(infoStr) function. File I use is written correctly, I get same error if I edit file and code to "," instead of "\t". Why is that happening? Edit: Issue was in skipping lines in text. Solved.</p>