title: can we use struct.unpack('<B', byte) without followed by print(var)
body: <p>I am new to python. I am writing a code to read a mask file. The code is below. It runs fine. But when I remove the print line at the end it give me the error 'unpack requires a buffer of 1 bytes'. I don't want to print the data. Any help will be appreciated.</p>
  
  <p>Thank you</p>
  
  <pre><code>filehandle= open(img_path+"/"+filename[0],'rb')
  byte = filehandle.read(1)
  mask=np.zeros(192*132)
  L=0;
  while byte:
      byte = filehandle.read(1)
      mask[L] = struct.unpack('&lt;B', byte)[0]     
      print(mask[L])
      L=L+1
  </code></pre>