old_contents: with open("test.txt") as f:
      lines = f.readlines()
      for line in lines:
          print line
  
new_contents: with open("test.txt") as f:
      line = f.readline()
      while line:
          print line
          line = f.readline()
  
subject: read file line by line