I need a functions that iterates over all the lines in the file.
Here s what I have so far:
def LineFeed(file):
ret = ""
for byte in file:
ret = ret + str(byte)
if str(byte) ==
:
yield ret
ret = ""
All the lines in the file end with
(not
), and I m reading it in "rb
" mode, (I have to read this file in binary).
The yield
doesn t work and returns nothing. Maybe there s a problem with the comparison?
I m just not sure how you represent a byte/char in python.
I m getting the idea that if you for loop on a "rb" file it still tries to iterate over lines not bytes..., How can I iterate over bytes? My problem is that I don t have standard line endings. Also my file is filled with 0x00 bytes and I would like to get rid of them all, so I think I would need a second yield function, how could I implement that, I just don t know how to represent the 0x00 byte in python or the NULL char.