so I have
f = open(infile, mode = 'rb')
while f:
line = f.read(int(k))
ints = list(line)
print(type(line))
etc etc….theoretically this is supposed to read the file in byte mode since I added ‘b’ to the mode…but then when the console outputs the print(type(line))….it would return the type as string rather than bytes…..what am I doing wrong?
I think, you should be using Python 2. (2.6/2.7) There str is a 8bit byte, so the the out is displayed as ‘str’. If you use Python 3 with your above code, you will find that type(line) will display
class 'bytes'.