while True:
    s = f.read(bufsize)
if not s:
    break
split = s.split(delim)
if len(split) > 1:
    yield prev + split[0]
prev = split[-1]
for x in split[1:-1]:
    yield x
else:
    prev += s
if prev:
    yield prev
Is there a way to read a file in a loop in python using a separator other than newline