def generate_lines(text):
 for line in text.splitlines(True):
  (yield line)
 while True:
  (yield '')

def generate_lines ( text ) : for line in text . splitlines ( True ) : ( yield line ) while True : ( yield '' )
generator that behaves like readline without using stringio .