title: Reading through file 4 lines at a time
body: <pre><code>import os
  filePath = "C:\\Users\\siba\\Desktop\\1x1x1.blb"
  BrickName = (os.path.splitext(os.path.basename(filePath))[0])
  
  import sys
  def ImportBLB(filePath):
      file = open(filePath)
      line = file.readline()
  
      while line:
          if(line == "POSITION:\n"):
              POS1 = file.next()
              POS2 = file.next()
              POS3 = file.next()
              POS4 = file.next()
              sys.stdout.write(POS1)
              sys.stdout.write(POS2)
              sys.stdout.write(POS3)
              sys.stdout.write(POS4)
              return
  
          line = file.readline()
      file.close()
      return
  
  ImportBLB(filePath)
  </code></pre>
  
  <p>I'm attempting to read through the file four lines at a time upon locating the line "POSITION:", but this only outputs the first four lines due to the return statement ending the loop.</p>
  
  <p>Removing the return statement gives me a "ValueError: Mixing iteration and read methods would lose data" error, how would I get around this?</p>