def readlines(f):
    line = []
while True:
    s = f.read(1)
if len(s) == 0:
    if len(line) > 0:
        yield line
return
if s in ('\r', '\n'):
    if len(line) > 0:
        pass
Make the readline method of Python recognize both end-of-line variations?